diff options
author | luigi <luigi@FreeBSD.org> | 2012-05-03 21:03:21 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2012-05-03 21:03:21 +0000 |
commit | a742cb5d5497339bd5a29d5ad3d4ccb7a787336c (patch) | |
tree | 0517f9ae3b41813357df315d802cc5ff03023f0d /tools | |
parent | 4a439608e65206db467ff579061d7ad4327a4b32 (diff) | |
download | FreeBSD-src-a742cb5d5497339bd5a29d5ad3d4ccb7a787336c.zip FreeBSD-src-a742cb5d5497339bd5a29d5ad3d4ccb7a787336c.tar.gz |
indicate the time per packet in nanoseconds.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/netrate/netsend/netsend.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/tools/netrate/netsend/netsend.c b/tools/tools/netrate/netsend/netsend.c index f97594e..0558253 100644 --- a/tools/tools/netrate/netsend/netsend.c +++ b/tools/tools/netrate/netsend/netsend.c @@ -147,6 +147,7 @@ timing_loop(struct _a *a) long minres_ns = 20000; int ic, gettimeofday_cycles; int cur_port; + uint64_t n, ns; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); @@ -257,6 +258,13 @@ done: printf("send errors: %ld\n", send_errors); printf("approx send rate: %ld pps\n", (send_calls - send_errors) / a->duration); + n = send_calls - send_errors; + if (n > 0) { + ns = (tmptime.tv_sec - starttime.tv_sec) * 1000000000UL + + (tmptime.tv_nsec - starttime.tv_nsec); + n = ns / n; + } + printf("time/packet: %u ns\n", (u_int)n); printf("approx error rate: %ld\n", (send_errors / send_calls)); printf("waited: %lld\n", waited); printf("approx waits/sec: %lld\n", (long long)(waited / a->duration)); |