pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/benchmarks/nttcp Add a new -U option, to run for a giv...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4d6dde3fb95a
branches:  trunk
changeset: 512589:4d6dde3fb95a
user:      simonb <simonb%pkgsrc.org@localhost>
date:      Fri May 12 03:07:14 2006 +0000

description:
Add a new -U option, to run for a given time instead of for a given
number of buffers.
Bump PKGREVISION.

Not feed upsteam as author seems to have disappeared :(

diffstat:

 benchmarks/nttcp/Makefile         |    3 +-
 benchmarks/nttcp/distinfo         |    5 +-
 benchmarks/nttcp/patches/patch-ab |  109 ++++++++++++++++++++++++++++++++++++-
 benchmarks/nttcp/patches/patch-ad |   14 ++++
 4 files changed, 124 insertions(+), 7 deletions(-)

diffs (167 lines):

diff -r 158cdf240470 -r 4d6dde3fb95a benchmarks/nttcp/Makefile
--- a/benchmarks/nttcp/Makefile Thu May 11 23:10:50 2006 +0000
+++ b/benchmarks/nttcp/Makefile Fri May 12 03:07:14 2006 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.4 2004/07/30 15:50:38 minskim Exp $
+# $NetBSD: Makefile,v 1.5 2006/05/12 03:07:14 simonb Exp $
 
 DISTNAME=      nttcp-1.47
+PKGREVISION=   1
 CATEGORIES=    benchmarks net
 MASTER_SITES=  http://www.leo.org/~elmar/nttcp/
 
diff -r 158cdf240470 -r 4d6dde3fb95a benchmarks/nttcp/distinfo
--- a/benchmarks/nttcp/distinfo Thu May 11 23:10:50 2006 +0000
+++ b/benchmarks/nttcp/distinfo Fri May 12 03:07:14 2006 +0000
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.6 2005/02/22 21:16:36 agc Exp $
+$NetBSD: distinfo,v 1.7 2006/05/12 03:07:14 simonb Exp $
 
 SHA1 (nttcp-1.47.tar.gz) = 28de7d65074e7546babdfa42b3b88fd8baa2be88
 RMD160 (nttcp-1.47.tar.gz) = 54b14062e84660b8d7982f702f94689cdce91d29
 Size (nttcp-1.47.tar.gz) = 25693 bytes
 SHA1 (patch-aa) = 98f93947b4d1e650ad371756463377a7c54704a3
-SHA1 (patch-ab) = a8e43a180e3042fba1d9aaf7a98c079519c7d7a5
+SHA1 (patch-ab) = c8fe3e59cf06c91719ffd00affaff26547e53e59
 SHA1 (patch-ac) = 5e7d4e81311c37187f72ff0ca54601c07fb90f17
+SHA1 (patch-ad) = fd369f9173933a4c56d188377d2e55fa43c9e032
diff -r 158cdf240470 -r 4d6dde3fb95a benchmarks/nttcp/patches/patch-ab
--- a/benchmarks/nttcp/patches/patch-ab Thu May 11 23:10:50 2006 +0000
+++ b/benchmarks/nttcp/patches/patch-ab Fri May 12 03:07:14 2006 +0000
@@ -1,13 +1,114 @@
-$NetBSD: patch-ab,v 1.2 2004/05/05 00:46:45 danw Exp $
+$NetBSD: patch-ab,v 1.3 2006/05/12 03:07:14 simonb Exp $
 
---- nttcp.c.orig       Mon Dec 18 21:16:54 2000
+--- nttcp.c.orig       2000-12-18 21:16:54.000000000 +1100
 +++ nttcp.c
-@@ -136,7 +136,7 @@
+@@ -136,9 +136,9 @@ void syslog(int priority, const char *me
  #endif /* aix */ 
  
  /*====================================================================*/
 -#if defined(FreeBSD)
 +#ifndef SIGCLD
  #define       SIGCLD  SIGCHLD
- #endif /*FreeBSD*/
+-#endif /*FreeBSD*/
++#endif /*SIGCLD*/
+ 
+ /*====================================================================*/
+ #if defined(BSD42)
+@@ -268,6 +268,7 @@ Usage: nttcp [local options] host [remot
+ \t-n# number of source bufs written to network (default 2048)\n\
+ \t-u  use UDP instead of TCP\n\
+ \t-g#us       gap in micro seconds between UDP packets (default 0s)\n\
++\t-U# run until a number of seconds have elapsed\n\
+ \t-d  set SO_DEBUG in sockopt\n\
+ \t-D  don't buffer TCP writes (sets TCP_NODELAY socket option)\n\
+ \t-w# set the send buffer space to #kilobytes, which is\n\
+@@ -346,6 +347,7 @@ typedef struct {
+     int FixedDataSize;                /* if>0: calc BufCnt/BufLen from this */
+     int Window,       SndWin, RcvWin; /* TCP window sizes */
+     int       Verbose;                /* ==1: more diagnostics */
++    int RunTime;              /* approximate runtime in seconds */
+     char *MulticastChannel;   /* we send multicast traffic */
+     short MulticastPort;      
+     int GapLength;            /* Gap length between packets */
+@@ -496,6 +498,13 @@ void StartTimer() {
+     SysCalls=0;
+ }
  
++int CheckTimer() {
++    TimeVal now;
++
++    gettimeofday(&now, (struct timezone *)0);
++    return opt.RunTime < (now.tv_sec - time0.tv_sec);
++}
++
+ void StopTimer(double *cput, double *realt) {
+     /* delivers in cput:  the amount of cpu time in seconds
+      *          in realt: the real time in seconds
+@@ -878,6 +887,7 @@ void InitOptions(Options *opt) {
+     opt->Verbose=0;           /* ==1: more diagnostics */
+     opt->GapLength=0;         /* no delay, send as fast as possible */
+     opt->inetd= 0;            /* ==1: run in inetd mode */
++    opt->RunTime = 0;         /* run effectively forever (ie BufCnt is limiting factor) */
+     opt->Service= GetService();       /* the service-port to listen to */
+     opt->MulticastChannel= NULL;
+     opt->MulticastPort= 0;
+@@ -1013,6 +1023,10 @@ void ParseOptions(int *ac, char **av[], 
+ #endif /*MULTICAST*/
+           break;
+         }
++        case 'U':
++          GetSizeValue(&argc, &argv, &opt->RunTime, 1000000000,
++            "runtime");
++          break;
+         default: {
+           strcpy(MsgBuf, "unknown option: ");
+           strncat(MsgBuf, argv[0], sizeof(MsgBuf)-strlen(MsgBuf)-1);
+@@ -1427,6 +1441,10 @@ int main(int argc, char *argv[]) {
+           sprintf(OptBuf, "-g%d", opt.GapLength);
+           StrVecAppend(RemOpt, OptBuf);
+       }
++      if (opt.RunTime > 0) {
++          sprintf(OptBuf, "-U%d", opt.RunTime);
++          StrVecAppend(RemOpt, OptBuf);
++      }
+       if (opt.MulticastChannel) {
+           sprintf(OptBuf, "-m%s:%d",
+             opt.MulticastChannel, opt.MulticastPort);
+@@ -1781,9 +1799,17 @@ int main(int argc, char *argv[]) {
+           else
+               Pattern(buf, opt.BufLen);
+           StartTimer();
+-          while (n-- && Nwrite(fd, buf, opt.BufLen) == opt.BufLen) {
++          while (Nwrite(fd, buf, opt.BufLen) == opt.BufLen) {
+               nBytes+= opt.BufLen;
+               nBuffer++;
++              if (opt.RunTime == 0) {
++                  if (--n == 0)
++                      break;
++              } else {
++                  /* XXX: tune how often to check if timer has expired? */
++                  if ((nBuffer % 100 == 0) && CheckTimer())
++                      break;
++              }
+           }
+           StopTimer(&cput, &realt);
+           opt.GapLength= 0;
+@@ -1797,9 +1823,17 @@ int main(int argc, char *argv[]) {
+           nBytes= 0;
+           nBuffer= 0;
+           StartTimer();
+-          while (n-- && Nwrite(fd, buf, opt.BufLen) == opt.BufLen) {
++          while (Nwrite(fd, buf, opt.BufLen) == opt.BufLen) {
+               nBytes+= opt.BufLen;
+               nBuffer++;
++              if (opt.RunTime == 0) {
++                  if (--n == 0)
++                      break;
++              } else {
++                  /* XXX: tune how often to check if timer has expired? */
++                  if ((nBuffer % 100 == 0) && CheckTimer())
++                      break;
++              }
+           }
+           StopTimer(&cput, &realt);
+       }
diff -r 158cdf240470 -r 4d6dde3fb95a benchmarks/nttcp/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/nttcp/patches/patch-ad Fri May 12 03:07:14 2006 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-ad,v 1.1 2006/05/12 03:07:14 simonb Exp $
+
+--- nttcp.1.orig       2000-08-16 20:20:45.000000000 +1000
++++ nttcp.1
+@@ -109,6 +109,9 @@ given fixed length.
+ Defines the buffer size of the transmitting and receiving socket.
+ This is system dependant; usally it is 16K.
+ .TP
++.BI "\-U " "number of seconds"
++Run until approximately the given number of seconds have passed.
++.TP
+ .B "\-c "
+ If this option is present, the receiving side will compare the
+ bytes received with the pattern used by the sending side. At



Home | Main Index | Thread Index | Old Index