2014-11-29

draw msgflow in reactive app





cpp_idioms.org



usually we got log like following:
[sys1] ---->   [sys2] 00001  MSG_0  0x00010002 0x00030004
[sys2] ---->   [sys3] 00002  MSG_1  0x00010002 0x00030004
[sys3] ---->   [sys1] 00003  MSG_2  0x00010002 0x00030004

but a diagram like following is more readable:
sys1   sys2   sys3   
  |----->|      |     MSG_0   [0x00010002 0x00030004]
  |      |----->|     MSG_1   [0x00010002 0x00030004]
  |<------------|     MSG_2   [0x00010002 0x00030004]

I implemented a simple app to draw this diagram: https://github.com/whunmr/msgflow

more complicated diagram generated from log:
ss3   kk3   zz1   qq1   qq2   kk1   bb1   aa1   ss1   
 |     |     |     |     |     |     |     |     *     MSG_0   [1] [0x00010002 0x00030004]
 |     |     |     |     |     |     |     |<----|     MSG_1   [2] [0x00010002 0x00030004]
 |     |     |     |     |     |     |     |---->|     MSG_2   [3] [0x00010002 0x00030004]
 |     |     |     |     |     |<----|     |     |     MSG_3   [4] [0x00010002 0x00030004]
 |     |     |     |     |     |---------------->|     MSG_4   [5] [0x00010002 0x00030004]
 |     |     |     |     |     |<----------------|     MSG_5   [6] [0x00010002 0x00030004]
 |     |     |     |     |     |     |     |<----|     MSG_6   [7] [0x00010002 0x00030004]
 |     |     |     |     |<----------------------|     MSG_7   [8] [0x00010002 0x00030004]
 |     |     |<----|     |     |     |     |     |     MSG_8   [9] [0x00010002 0x00030004]
 |     |     |---------------------------->|     |     MSG_9   [10] [0x00010002 0x00030004]
 |     |     |     |     |     |     |     |---->|     MSG_2   [11] [0x00010002 0x00030004]
 |     |<----------------------------|     |     |     MSG_3   [12] [0x00010002 0x00030004]
 |     |     |     |     |     |---------------->|     MSG_4   [13] [0x00010002 0x00030004]
 |     |<----------------------------------------|     MSG_5   [14] [0x00010002 0x00030004]
 |---------------------------------------->|     |     MSG_6   [15] [0x00010002 0x00030004]
 |---------------->|     |     |     |     |     |     MSG_7   [16] [0x00010002 0x00030004]
 |     |     |<----------------------------------|     MSG_8   [17] [0x00010002 0x00030004]
 |     |     |---------------------------------->|     MSG_9   [18] [0x00010002 0x00030004]