Browse Source

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.

1.0.0
Georg Hopp 11 years ago
parent
commit
93ccec2fef
  1. 24
      testers/test_handler.c
  2. 1
      testers/test_handler.h
  3. 4
      testers/testclient.sh

24
testers/test_handler.c

@ -11,10 +11,28 @@ static
TR_EventDone
testHandlerHeartbeat(TR_EventHandler this, TR_Event event)
{
printf("%zd beat(s) since last beat / handled: %llu/s\n",
double size = (double)((TestHandler)this)->size;
double size_msg = ((TestHandler)this)->size
? size / ((TestHandler)this)->handled
: 0.0;
int div_count = 0;
while (size > 1024. && div_count != 'G') {
size /= 1024.;
switch (div_count) {
case 0: div_count = 'K'; break;
case 'K': div_count = 'M'; break;
case 'M': div_count = 'G'; break;
}
}
printf("%zd beat(s) since last beat / "
"handled: %llu msg/s %4.2lf %cBytes/s %4.0lf Bytes/msg\n",
((TR_EventDispatcher)event->subject)->n_beats,
((TestHandler)this)->handled);
((TestHandler)this)->handled,
size, div_count, size_msg);
((TestHandler)this)->handled = 0;
((TestHandler)this)->size = 0;
return TR_EVENT_DONE;
}
@ -24,8 +42,10 @@ TR_EventDone
testHandlerNewMessage(TR_EventHandler this, TR_Event event)
{
TR_Event _event;
TR_ProtoMessageRaw message = event->data;
((TestHandler)this)->handled++;
((TestHandler)this)->size += ((TR_SizedData)message->data)->size;
_event = TR_eventSubjectEmit(
event->subject,

1
testers/test_handler.h

@ -9,6 +9,7 @@
TR_CLASS(TestHandler) {
TR_EXTENDS(TR_EventHandler);
unsigned long long handled;
unsigned long long size;
};
TR_INSTANCE_INIT(TestHandler);
TR_CLASSVARS_DECL(TestHandler) {

4
testers/testclient.sh

@ -1,8 +1,8 @@
#!/bin/sh
BS=$((128*1024))
COUNT=10000
CONCURENT=200
COUNT=1000000
CONCURENT=2
IP="192.168.2.13"
pids=""
i=0

Loading…
Cancel
Save