[netperf-dev] netperf2 commit notice r89 - trunk/src

raj at netperf.org raj at netperf.org
Wed Feb 7 17:12:30 PST 2007


Author: raj
Date: 2007-02-07 17:12:28 -0800 (Wed, 07 Feb 2007)
New Revision: 89

Modified:
   trunk/src/netcpu_procstat.c
   trunk/src/netlib.c
   trunk/src/netlib.h
   trunk/src/netperf.c
   trunk/src/nettest_bsd.c
Log:
make actual histogram work conditional on verbosity in nettest_bsd.c and some -Wall cleanups

Modified: trunk/src/netcpu_procstat.c
===================================================================
--- trunk/src/netcpu_procstat.c	2007-02-08 00:37:01 UTC (rev 88)
+++ trunk/src/netcpu_procstat.c	2007-02-08 01:12:28 UTC (rev 89)
@@ -166,7 +166,7 @@
     };
     res[i] = strtoul (p, &p, 10);
     if (debug) {
-      fprintf(where,"res[%d] is %d\n",i,res[i]);
+      fprintf(where,"res[%d] is %llu\n",i,res[i]);
       fflush(where);
     }
     p = strchr (p, '\n');

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2007-02-08 00:37:01 UTC (rev 88)
+++ trunk/src/netlib.c	2007-02-08 01:12:28 UTC (rev 89)
@@ -984,8 +984,7 @@
  /* should detect the presence of POSIX.4 timer_* routines one of */
  /* these days */
 void
-start_itimer( interval_len_msec )
-     unsigned int interval_len_msec;
+start_itimer(unsigned int interval_len_msec )
 {
 
   unsigned int ticks_per_itvl;
@@ -1046,8 +1045,8 @@
 netlib_init_cpu_map() {
 
   int i;
-  int num;
 #ifdef HAVE_MPCTL
+  int num;
   i = 0;
   /* I go back and forth on whether this should be the system-wide set
      of calls, or if the processor set versions (sans the _SYS) should

Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h	2007-02-08 00:37:01 UTC (rev 88)
+++ trunk/src/netlib.h	2007-02-08 01:12:28 UTC (rev 89)
@@ -515,7 +515,11 @@
 #endif /* WANT_DLPI */
 extern  char    format_cpu_method(int method);
 extern unsigned int convert(char *string);
+extern unsigned int convert_timespec(char *string);
 
+#ifdef WANT_INTERVALS
+extern void start_itimer(unsigned int interval_len_msec);
+#endif
  /* these are all for the confidence interval stuff */
 extern double confidence;
 

Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c	2007-02-08 00:37:01 UTC (rev 88)
+++ trunk/src/netperf.c	2007-02-08 01:12:28 UTC (rev 89)
@@ -44,9 +44,11 @@
 char	netperf_id[]="\
 @(#)netperf.c (c) Copyright 1993-2004 Hewlett-Packard Company. Version 2.3";
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
 

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2007-02-08 00:37:01 UTC (rev 88)
+++ trunk/src/nettest_bsd.c	2007-02-08 01:12:28 UTC (rev 89)
@@ -129,7 +129,7 @@
 #include "netsh.h"
 #include "nettest_bsd.h"
 
-#ifdef WANT_HISTOGRAM
+#if defined(WANT_HISTOGRAM) || defined(WANT_DEMO) 
 #include "hist.h"
 #endif /* WANT_HISTOGRAM */
 
@@ -1308,7 +1308,9 @@
     (struct tcp_stream_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
   /* since we are now disconnected from the code that established the */
   /* control socket, and since we want to be able to use different */
@@ -1565,9 +1567,13 @@
 #endif /* DIRTY */
       
 #ifdef WANT_HISTOGRAM
-      /* timestamp just before we go into send and then again just after */
-      /* we come out raj 8/94 */
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	/* timestamp just before we go into send and then again just
+	 after we come out raj 8/94 */
+	/* but lets only do this if there is going to be a histogram
+	   displayed */
+	HIST_timestamp(&time_one);
+      }
 #endif /* WANT_HISTOGRAM */
 
       if((len=send(send_socket,
@@ -1584,9 +1590,11 @@
       }
 
 #ifdef WANT_HISTOGRAM
-      /* timestamp the exit from the send call and update the histogram */
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	/* timestamp the exit from the send call and update the histogram */
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */      
 
 #ifdef WANT_DEMO
@@ -1980,7 +1988,9 @@
     (struct tcp_maerts_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
   /* since we are now disconnected from the code that established the */
   /* control socket, and since we want to be able to use different */
@@ -2223,9 +2233,13 @@
        2002-06-21 */
 
 #ifdef WANT_HISTOGRAM
-      /* timestamp just before we go into recv and then again just after */
-      /* we come out raj 8/94 */
+    if (verbosity > 1) {
+      /* timestamp just before we go into recv and then again just
+	 after we come out raj 8/94 */
+      /* but only if we are actually going to display a histogram. raj
+	 2006-02-07 */
       HIST_timestamp(&time_one);
+    }
 #endif /* WANT_HISTOGRAM */
     
     while ((len=recv(recv_socket,
@@ -2234,9 +2248,11 @@
 		     0)) > 0 ) {
 
 #ifdef WANT_HISTOGRAM
-      /* timestamp the exit from the recv call and update the histogram */
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	/* timestamp the exit from the recv call and update the histogram */
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */      
 
 #ifdef DIRTY
@@ -2266,9 +2282,11 @@
       }
 
 #ifdef WANT_HISTOGRAM
-      /* make sure we timestamp just before we go into recv  */
-      /* raj 2004-06-15 */
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	/* make sure we timestamp just before we go into recv  */
+	/* raj 2004-06-15 */
+	HIST_timestamp(&time_one);
+      }
 #endif /* WANT_HISTOGRAM */
     
     }
@@ -3433,7 +3451,9 @@
     (struct tcp_stream_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -3730,11 +3750,12 @@
 	 dirty. 08/2000 */
       
 #ifdef WANT_HISTOGRAM
-      
-      /* timestamp just before we go into sendfile() and then again just
-         after we come out raj 08/2000 */
-      
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	/* timestamp just before we go into sendfile() and then again
+         just after we come out raj 08/2000 */
+	/* but only if we are actually going to display a histogram */
+	HIST_timestamp(&time_one);
+      }
 #endif /* WANT_HISTOGRAM */
       
       /* you can look at netlib.h for a description of the fields we
@@ -3798,11 +3819,13 @@
       /*	offset += len;*/
       
 #ifdef WANT_HISTOGRAM
-      /* timestamp the exit from the send call and update the histogram */
+      if (verbosity > 1) {
+	/* timestamp the exit from the send call and update the
+	   histogram */
       
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
-
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */      
     
 #ifdef WANT_DEMO
@@ -4912,7 +4935,9 @@
     (struct tcp_rr_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -5179,9 +5204,14 @@
 #endif /* WANT_FIRST_BURST */
       
 #ifdef WANT_HISTOGRAM
-      /* timestamp just before our call to send, and then again just */
-      /* after the receive raj 8/94 */
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	/* timestamp just before our call to send, and then again just
+	   after the receive raj 8/94 */
+	/* but only if we are actually going to display one. raj
+	   2007-02-07 */
+
+	HIST_timestamp(&time_one);
+      }
 #endif /* WANT_HISTOGRAM */
       
       if ((len = send(send_socket,
@@ -5247,8 +5277,10 @@
       }
       
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */
 
 #ifdef WANT_DEMO
@@ -5594,7 +5626,9 @@
     (struct udp_stream_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -5788,7 +5822,9 @@
 #endif /* DIRTY */
       
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	HIST_timestamp(&time_one);
+      }
 #endif /* WANT_HISTOGRAM */
      
       if (local_connected) { 
@@ -5825,9 +5861,11 @@
       
       
 #ifdef WANT_HISTOGRAM
-      /* get the second timestamp */
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	/* get the second timestamp */
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */
 
 #ifdef WANT_INTERVALS      
@@ -6456,7 +6494,9 @@
     (struct udp_rr_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif
   
   /* since we are now disconnected from the code that established the */
@@ -6695,7 +6735,9 @@
     while ((!times_up) || (trans_remaining > 0)) {
       /* send the request */
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	HIST_timestamp(&time_one);
+      }
 #endif
       if((len=send(send_socket,
 		   send_ring->buffer_ptr,
@@ -6728,15 +6770,18 @@
       recv_ring = recv_ring->next;
       
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
-      
+      if (verbosity > 1) {
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
+
+#endif
+
       /* at this point, we may wish to sleep for some period of */
       /* time, so we see how long that last transaction just took, */
       /* and sleep for the difference of that and the interval. We */
       /* will not sleep if the time would be less than a */
       /* millisecond.  */
-#endif
 
 #ifdef WANT_DEMO
       DEMO_RR_INTERVAL(1);
@@ -7807,7 +7852,9 @@
   
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -7992,9 +8039,11 @@
   while ((!times_up) || (trans_remaining > 0)) {
 
 #ifdef WANT_HISTOGRAM
-    /* timestamp just before our call to create the socket, and then */
-    /* again just after the receive raj 3/95 */
-    HIST_timestamp(&time_one);
+    if (verbosity > 1) {
+      /* timestamp just before our call to create the socket, and then */
+      /* again just after the receive raj 3/95 */
+      HIST_timestamp(&time_one);
+    }
 #endif /* WANT_HISTOGRAM */
 
 newport:
@@ -8113,8 +8162,10 @@
       recv_ring = recv_ring->next;
 
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */
 
 #ifdef WANT_DEMO
@@ -8842,7 +8893,9 @@
   
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -9032,9 +9085,11 @@
   while ((!times_up) || (trans_remaining > 0)) {
 
 #ifdef WANT_HISTOGRAM
-    /* timestamp just before our call to create the socket, and then */
-    /* again just after the receive raj 3/95 */
-    HIST_timestamp(&time_one);
+    if (verbosity > 1) {
+      /* timestamp just before our call to create the socket, and then */
+      /* again just after the receive raj 3/95 */
+      HIST_timestamp(&time_one);
+    }
 #endif /* WANT_HISTOGRAM */
 
     /* set up the data socket - is this really necessary or can I just */
@@ -9167,8 +9222,10 @@
     close(send_socket);
 
 #ifdef WANT_HISTOGRAM
-    HIST_timestamp(&time_two);
-    HIST_add(time_hist,delta_micro(&time_one,&time_two));
+    if (verbosity > 1) {
+      HIST_timestamp(&time_two);
+      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+    }
 #endif /* WANT_HISTOGRAM */
 
     nummessages++;          
@@ -9903,7 +9960,9 @@
     (struct tcp_rr_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -10124,9 +10183,11 @@
       /* the request will be sent at one shot. */
       
 #ifdef WANT_HISTOGRAM
-      /* timestamp just before our call to send, and then again just */
-      /* after the receive raj 8/94 */
-      HIST_timestamp(&time_one);
+      if (verbosity > 1) {
+	/* timestamp just before our call to send, and then again just */
+	/* after the receive raj 8/94 */
+	HIST_timestamp(&time_one);
+      }
 #endif /* WANT_HISTOGRAM */
 
       /* even though this is a non-blocking socket, we will assume for */
@@ -10183,8 +10244,10 @@
       }
       
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */
 #ifdef WANT_INTERVALS      
       INTERVALS_WAIT();
@@ -10916,7 +10979,9 @@
   
   
 #ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
+  if (verbosity > 1) {
+    time_hist = HIST_new();
+  }
 #endif /* WANT_HISTOGRAM */
 
   /* since we are now disconnected from the code that established the */
@@ -11089,9 +11154,11 @@
   while ((!times_up) || (trans_remaining > 0)) {
 
 #ifdef WANT_HISTOGRAM
-    /* timestamp just before our call to create the socket, and then */
-    /* again just after the receive raj 3/95 */
-    HIST_timestamp(&time_one);
+    if (verbosity > 1) {
+      /* timestamp just before our call to create the socket, and then */
+      /* again just after the receive raj 3/95 */
+      HIST_timestamp(&time_one);
+    }
 #endif /* WANT_HISTOGRAM */
 
     /* set up the data socket */
@@ -11165,8 +11232,10 @@
       /* number of bytes have been received */
 
 #ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      if (verbosity > 1) {
+	HIST_timestamp(&time_two);
+	HIST_add(time_hist,delta_micro(&time_one,&time_two));
+      }
 #endif /* WANT_HISTOGRAM */
 
 #ifdef WANT_DEMO



More information about the netperf-dev mailing list