From 6a5120b1f1c48d19b777f76ac756b00fb624d110 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 2 Sep 2009 10:22:23 +0200 Subject: python extension & perf tests --- perf/c/local_thr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'perf/c') diff --git a/perf/c/local_thr.c b/perf/c/local_thr.c index 87c3220..b58fac3 100644 --- a/perf/c/local_thr.c +++ b/perf/c/local_thr.c @@ -38,6 +38,7 @@ int main (int argc, char *argv []) struct timeval end; uint64_t elapsed; uint64_t throughput; + double megabits; if (argc != 4) { printf ("usage: local_thr " @@ -81,12 +82,15 @@ int main (int argc, char *argv []) elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) - ((uint64_t) start.tv_sec * 1000000 + start.tv_usec); - + if (elapsed == 0) + elapsed = 1; throughput = (uint64_t) message_count * 1000000 / elapsed; + megabits = (double) (throughput * message_size * 8) / 1000000; printf ("message size: %d [B]\n", (int) message_size); printf ("message count: %d\n", (int) message_count); printf ("mean throughput: %d [msg/s]\n", (int) throughput); + printf ("mean throughput: %3f [Mb/s]\n", (double) megabits); return 0; } -- cgit v1.2.3