pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/benchmarks/ttcp Print statistics to stderr, not to std...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4167ec560a18
branches:  trunk
changeset: 478791:4167ec560a18
user:      he <he%pkgsrc.org@localhost>
date:      Fri Jul 30 10:16:52 2004 +0000

description:
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:

 benchmarks/ttcp/Makefile         |   4 +-
 benchmarks/ttcp/distinfo         |   4 +-
 benchmarks/ttcp/patches/patch-ab |  74 +++++++++++++++++++++++++++++++++------
 3 files changed, 66 insertions(+), 16 deletions(-)

diffs (165 lines):

diff -r fe452887f4ee -r 4167ec560a18 benchmarks/ttcp/Makefile
--- a/benchmarks/ttcp/Makefile  Fri Jul 30 09:57:54 2004 +0000
+++ b/benchmarks/ttcp/Makefile  Fri Jul 30 10:16:52 2004 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.8 2004/05/13 17:57:05 minskim Exp $
+# $NetBSD: Makefile,v 1.9 2004/07/30 10:16:52 he Exp $
 
 DISTNAME=      ttcp
 PKGNAME=       ${DISTNAME}-1.12
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    benchmarks net
 MASTER_SITES=  http://www.ccci.com/tools/ttcp/
 EXTRACT_SUFX=  .tar.Z
diff -r fe452887f4ee -r 4167ec560a18 benchmarks/ttcp/distinfo
--- a/benchmarks/ttcp/distinfo  Fri Jul 30 09:57:54 2004 +0000
+++ b/benchmarks/ttcp/distinfo  Fri Jul 30 10:16:52 2004 +0000
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.5 2003/03/19 13:12:22 tron Exp $
+$NetBSD: distinfo,v 1.6 2004/07/30 10:16:52 he Exp $
 
 SHA1 (ttcp.tar.Z) = 33a60af208eff3dc9ae745060f44b24c4e74aa7e
 Size (ttcp.tar.Z) = 18163 bytes
 SHA1 (patch-aa) = a9717aa9fd5f8cdff1a39c9b7d6ab17abbe399ad
-SHA1 (patch-ab) = e84c027a0b2c1ab55682faa14a7e3e447cb3175e
+SHA1 (patch-ab) = 4966c7024bb18301f18a8ca2cbc821f56af3aea9
diff -r fe452887f4ee -r 4167ec560a18 benchmarks/ttcp/patches/patch-ab
--- a/benchmarks/ttcp/patches/patch-ab  Fri Jul 30 09:57:54 2004 +0000
+++ b/benchmarks/ttcp/patches/patch-ab  Fri Jul 30 10:16:52 2004 +0000
@@ -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 @@
  
  #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 @@
        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 @@
 +              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 @@
                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 @@
                        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 @@
                                &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 @@
                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 @@
                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;



Home | Main Index | Thread Index | Old Index