summaryrefslogtreecommitdiff
path: root/benchmarks/kttcp
diff options
context:
space:
mode:
authorthorpej <thorpej@pkgsrc.org>2002-06-30 19:25:47 +0000
committerthorpej <thorpej@pkgsrc.org>2002-06-30 19:25:47 +0000
commit052a5ccc23af9723e1ebace90d96e5a34fb2ffe1 (patch)
tree0875036852886e6359ddf07edb246bb1d3eb6669 /benchmarks/kttcp
parentf58166dc38066330e2ad02f744015d1c93868c4e (diff)
downloadpkgsrc-052a5ccc23af9723e1ebace90d96e5a34fb2ffe1.tar.gz
Also report speed in Megabits/sec (both 1024- and 1000-based Mega).
Diffstat (limited to 'benchmarks/kttcp')
-rw-r--r--benchmarks/kttcp/files/kttcp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/benchmarks/kttcp/files/kttcp.c b/benchmarks/kttcp/files/kttcp.c
index 29bd5d3dc42..89e69794499 100644
--- a/benchmarks/kttcp/files/kttcp.c
+++ b/benchmarks/kttcp/files/kttcp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kttcp.c,v 1.2 2002/06/30 19:15:57 thorpej Exp $ */
+/* $NetBSD: kttcp.c,v 1.3 2002/06/30 19:25:47 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
struct kttcp_io_args kio;
struct addrinfo hints, *addr, *res;
struct sockaddr_storage ss;
- unsigned long long usecs, bytespersec, xmitsize;
+ unsigned long long usecs, bytespersec, bitspersec, xmitsize;
char connecthost[NI_MAXHOST];
socklen_t slen;
const int one = 1;
@@ -222,9 +222,13 @@ main(int argc, char *argv[])
usecs += kio.kio_elapsed.tv_usec;
bytespersec = kio.kio_bytesdone * 1000000LL / usecs;
+ bitspersec = bytespersec * NBBY;
printf("kttcp: %llu bytes in %ld.%03ld seconds ==> %llu bytes/sec\n",
kio.kio_bytesdone, kio.kio_elapsed.tv_sec,
kio.kio_elapsed.tv_usec / 1000, bytespersec);
+ printf(" %g (%g) Megabits/sec\n",
+ ((double) bitspersec / 1024.0) / 1024.0,
+ ((double) bitspersec / 1000.0) / 1000.0);
close(kio.kio_socket);
if (cmd == KTTCP_IO_RECV)