Commit 93ccec2fef14e069c30fb5c97bf5b23178e612bf
1 parent
b7d83002
show some information about the bytes per second throughput. Currently I manage …
…around 1.1 GBytes on a loopback device which sounds not to bad, but is only about 1/4 of the throughput iperf shows me... but this might be related to nc... I will see this when I have written my own client.
Showing
3 changed files
with
26 additions
and
5 deletions
... | ... | @@ -11,10 +11,28 @@ static |
11 | 11 | TR_EventDone |
12 | 12 | testHandlerHeartbeat(TR_EventHandler this, TR_Event event) |
13 | 13 | { |
14 | - printf("%zd beat(s) since last beat / handled: %llu/s\n", | |
14 | + double size = (double)((TestHandler)this)->size; | |
15 | + double size_msg = ((TestHandler)this)->size | |
16 | + ? size / ((TestHandler)this)->handled | |
17 | + : 0.0; | |
18 | + int div_count = 0; | |
19 | + | |
20 | + while (size > 1024. && div_count != 'G') { | |
21 | + size /= 1024.; | |
22 | + switch (div_count) { | |
23 | + case 0: div_count = 'K'; break; | |
24 | + case 'K': div_count = 'M'; break; | |
25 | + case 'M': div_count = 'G'; break; | |
26 | + } | |
27 | + } | |
28 | + | |
29 | + printf("%zd beat(s) since last beat / " | |
30 | + "handled: %llu msg/s %4.2lf %cBytes/s %4.0lf Bytes/msg\n", | |
15 | 31 | ((TR_EventDispatcher)event->subject)->n_beats, |
16 | - ((TestHandler)this)->handled); | |
32 | + ((TestHandler)this)->handled, | |
33 | + size, div_count, size_msg); | |
17 | 34 | ((TestHandler)this)->handled = 0; |
35 | + ((TestHandler)this)->size = 0; | |
18 | 36 | |
19 | 37 | return TR_EVENT_DONE; |
20 | 38 | } |
... | ... | @@ -23,9 +41,11 @@ static |
23 | 41 | TR_EventDone |
24 | 42 | testHandlerNewMessage(TR_EventHandler this, TR_Event event) |
25 | 43 | { |
26 | - TR_Event _event; | |
44 | + TR_Event _event; | |
45 | + TR_ProtoMessageRaw message = event->data; | |
27 | 46 | |
28 | 47 | ((TestHandler)this)->handled++; |
48 | + ((TestHandler)this)->size += ((TR_SizedData)message->data)->size; | |
29 | 49 | |
30 | 50 | _event = TR_eventSubjectEmit( |
31 | 51 | event->subject, | ... | ... |
Please
register
or
login
to post a comment