summaryrefslogtreecommitdiff
path: root/benchmarks/ttcp/patches
diff options
context:
space:
mode:
authorhe <he>2004-07-30 10:16:52 +0000
committerhe <he>2004-07-30 10:16:52 +0000
commitc120c4f9ed2d36146c55f6e3f2e78e1e4f114131 (patch)
treee69e630633c2d1702325b13dc99957630aba4cf0 /benchmarks/ttcp/patches
parent865ae479ee8f3a315dde774a69c67ca3bccfd425 (diff)
downloadpkgsrc-c120c4f9ed2d36146c55f6e3f2e78e1e4f114131.tar.gz
Print statistics to stderr, not to stdout, so that this program
can be used for bulk data transport without adding any crud at the receiving end. Bump pkgrevision to 2.
Diffstat (limited to 'benchmarks/ttcp/patches')
-rw-r--r--benchmarks/ttcp/patches/patch-ab74
1 files changed, 62 insertions, 12 deletions
diff --git a/benchmarks/ttcp/patches/patch-ab b/benchmarks/ttcp/patches/patch-ab
index 51d657c088f..119278f9291 100644
--- a/benchmarks/ttcp/patches/patch-ab
+++ b/benchmarks/ttcp/patches/patch-ab
@@ -1,8 +1,8 @@
-$NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
+$NetBSD: patch-ab,v 1.5 2004/07/30 10:16:52 he Exp $
--- ttcp.c.orig 1997-02-27 22:30:23.000000000 +0100
-+++ ttcp.c 2003-03-19 14:09:08.000000000 +0100
-@@ -55,6 +55,7 @@
++++ ttcp.c
+@@ -55,6 +55,7 @@ static char RCSid[] = "ttcp.c $Revision:
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/time.h> /* struct timeval */
@@ -10,7 +10,7 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
#if defined(SYSV)
#include <sys/times.h>
-@@ -151,7 +152,7 @@
+@@ -151,7 +152,7 @@ main(argc,argv)
int argc;
char **argv;
{
@@ -19,7 +19,7 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
int c;
if (argc < 2) goto usage;
-@@ -263,7 +264,7 @@
+@@ -263,29 +264,30 @@ char **argv;
if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL)
err("malloc");
if (bufalign != 0)
@@ -27,8 +27,27 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
+ buf +=(bufalign - ((u_long)buf % bufalign) + bufoffset) % bufalign;
if (trans) {
- fprintf(stdout,
-@@ -285,7 +286,8 @@
+- fprintf(stdout,
++ fprintf(stderr,
+ "ttcp-t: buflen=%d, nbuf=%d, align=%d/%d, port=%d",
+ buflen, nbuf, bufalign, bufoffset, port);
+ if (sockbufsize)
+- fprintf(stdout, ", sockbufsize=%d", sockbufsize);
++ fprintf(stderr, ", sockbufsize=%d", sockbufsize);
+ fprintf(stdout, " %s -> %s\n", udp?"udp":"tcp", host);
+ } else {
+- fprintf(stdout,
++ fprintf(stderr,
+ "ttcp-r: buflen=%d, nbuf=%d, align=%d/%d, port=%d",
+ buflen, nbuf, bufalign, bufoffset, port);
+ if (sockbufsize)
+- fprintf(stdout, ", sockbufsize=%d", sockbufsize);
+- fprintf(stdout, " %s\n", udp?"udp":"tcp");
++ fprintf(stderr, ", sockbufsize=%d", sockbufsize);
++ fprintf(stderr, " %s\n", udp?"udp":"tcp");
+ }
+
+ if ((fd = socket(AF_INET, udp?SOCK_DGRAM:SOCK_STREAM, 0)) < 0)
err("socket");
mes("socket");
@@ -38,7 +57,7 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
err("bind");
#if defined(SO_SNDBUF) || defined(SO_RCVBUF)
-@@ -326,7 +328,7 @@
+@@ -326,7 +328,7 @@ char **argv;
mes("nodelay");
}
#endif
@@ -47,7 +66,7 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
err("connect");
mes("connect");
} else {
-@@ -348,11 +350,11 @@
+@@ -348,11 +350,11 @@ char **argv;
}
fromlen = sizeof(frominet);
domain = AF_INET;
@@ -61,7 +80,38 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
&peerlen) < 0) {
err("getpeername");
}
-@@ -752,7 +754,7 @@
+@@ -412,25 +414,25 @@ char **argv;
+ }
+ if( cput <= 0.0 ) cput = 0.001;
+ if( realt <= 0.0 ) realt = 0.001;
+- fprintf(stdout,
++ fprintf(stderr,
+ "ttcp%s: %.0f bytes in %.2f real seconds = %s/sec +++\n",
+ trans?"-t":"-r",
+ nbytes, realt, outfmt(nbytes/realt));
+ if (verbose) {
+- fprintf(stdout,
++ fprintf(stderr,
+ "ttcp%s: %.0f bytes in %.2f CPU seconds = %s/cpu sec\n",
+ trans?"-t":"-r",
+ nbytes, cput, outfmt(nbytes/cput));
+ }
+- fprintf(stdout,
++ fprintf(stderr,
+ "ttcp%s: %d I/O calls, msec/call = %.2f, calls/sec = %.2f\n",
+ trans?"-t":"-r",
+ numCalls,
+ 1024.0 * realt/((double)numCalls),
+ ((double)numCalls)/realt);
+- fprintf(stdout,"ttcp%s: %s\n", trans?"-t":"-r", stats);
++ fprintf(stderr,"ttcp%s: %s\n", trans?"-t":"-r", stats);
+ if (verbose) {
+- fprintf(stdout,
++ fprintf(stderr,
+ "ttcp%s: buffer address %#x\n",
+ trans?"-t":"-r",
+ buf);
+@@ -752,7 +754,7 @@ int count;
int len = sizeof(from);
register int cnt;
if( udp ) {
@@ -70,7 +120,7 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
numCalls++;
} else {
if( b_flag )
-@@ -782,7 +784,7 @@
+@@ -782,7 +784,7 @@ int count;
register int cnt;
if( udp ) {
again:
@@ -79,7 +129,7 @@ $NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $
numCalls++;
if( cnt<0 && errno == ENOBUFS ) {
delay(18000);
-@@ -803,7 +805,7 @@
+@@ -803,7 +805,7 @@ delay(us)
tv.tv_sec = 0;
tv.tv_usec = us;