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

raj at netperf.org raj at netperf.org
Mon Mar 14 15:19:02 PDT 2011


Author: raj
Date: 2011-03-14 15:19:02 -0700 (Mon, 14 Mar 2011)
New Revision: 387

Modified:
   trunk/src/hist.h
   trunk/src/netlib.c
   trunk/src/nettest_omni.c
Log:
fix tcp_info compilation issues on older kit like rhel5 eliminate some compiler warnings and fix up some stuff with bursted histograms and confidence intervals

Modified: trunk/src/hist.h
===================================================================
--- trunk/src/hist.h	2011-02-08 22:32:33 UTC (rev 386)
+++ trunk/src/hist.h	2011-03-14 22:19:02 UTC (rev 387)
@@ -105,6 +105,13 @@
 void HIST_clear(HIST h);
 
 /*
+   HIST_purge - forget about any remaining outstanding timestamps
+   being tracked 
+*/
+
+void HIST_purge(HIST h);
+
+/*
    HIST_add - add a time difference to a histogram. Time should be in
    microseconds. 
 */

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2011-02-08 22:32:33 UTC (rev 386)
+++ trunk/src/netlib.c	2011-03-14 22:19:02 UTC (rev 387)
@@ -1457,7 +1457,7 @@
     /* get the ring element */
     temp_link = (struct ring_elt *)malloc(sizeof(struct ring_elt));
     if (temp_link == NULL) {
-      printf("malloc(%u) failed!\n", sizeof(struct ring_elt));
+      printf("malloc(%u) failed!\n", (unsigned int)sizeof(struct ring_elt));
       exit(1);
     }
     /* remember the first one so we can close the ring at the end */
@@ -1825,7 +1825,7 @@
     temp_link = (struct sendfile_ring_elt *)
       malloc(sizeof(struct sendfile_ring_elt));
     if (temp_link == NULL) {
-      printf("malloc(%u) failed!\n", sizeof(struct sendfile_ring_elt));
+      printf("malloc(%u) failed!\n",(unsigned int) sizeof(struct sendfile_ring_elt));
       exit(1);
 	}
 
@@ -2361,7 +2361,7 @@
 
     fprintf(where,
             "\nsend_request: about to send %u bytes from %p\n",
-            sizeof(netperf_request),
+            (unsigned int) sizeof(netperf_request),
             &netperf_request);
     fflush(where);
   }
@@ -2434,7 +2434,7 @@
   if (debug > 1) {
     fprintf(where,
             "send_response_n: contents of %u ints before %d htonl,\n",
-            sizeof(netperf_response)/4,
+            (unsigned int) sizeof(netperf_response)/4,
 	    count);
     dump_response();
   }
@@ -2455,7 +2455,7 @@
     dump_response();
     fprintf(where,
             "about to send %u bytes from %p\n",
-            sizeof(netperf_response),
+            (unsigned int) sizeof(netperf_response),
             &netperf_response);
     fflush(where);
   }
@@ -3775,30 +3775,28 @@
     exit(1);
   }
   HIST_clear(h);
-  /* now allocate the time_ones based on max_outstanding */
-  if (max_outstanding > 0) {
+
+  /* we never want to have a full queue, so will trade a little space
+     for that. one day we may still have to check for a full queue */
+  h->limit = max_outstanding + 1; 
+
+  /* now allocate the time_ones based on h->limit */
 #ifdef HAVE_GETHRTIME
-    h->time_ones = (hrtime_t *) malloc(max_outstanding * sizeof(hrtime_t));
+  h->time_ones = (hrtime_t *) malloc(h->limit * sizeof(hrtime_t));
 #elif HAVE_GET_HRT
-    h->time_ones = (hrt_t *) malloc(max_outstanding * sizeof(hrt_t));
+  h->time_ones = (hrt_t *) malloc(h->limit * sizeof(hrt_t));
 #elif defined(WIN32)
-    h->time_ones = (LARGE_INTEGER *) malloc(max_outstanding * 
-					    sizeof(LARGE_INTEGER));
+  h->time_ones = (LARGE_INTEGER *) malloc(h->limit * 
+					  sizeof(LARGE_INTEGER));
 #else
-    h->time_ones = (struct timeval *) malloc(max_outstanding * 
-					     sizeof(struct timeval));
+  h->time_ones = (struct timeval *) malloc(h->limit * 
+					   sizeof(struct timeval));
 #endif /* HAVE_GETHRTIME */
-    if (h->time_ones == NULL) {
-      perror("HIST_new_n - time_ones malloc failed");
-      exit(1);
-    }
+  if (h->time_ones == NULL) {
+    perror("HIST_new_n - time_ones malloc failed");
+    exit(1);
   }
-  else {
-    h->time_ones = NULL;
-  }
-  /* we never want to have a full queue, so will trade a little space
-     for that. one day we may still have to check for a full queue */
-  h->limit = max_outstanding + 1; 
+  
   return h;
 }
   
@@ -3834,6 +3832,13 @@
    h->time_ones = NULL;
 }
 
+void
+HIST_purge(HIST h) {
+  h->count = 0;
+  h->producer = 0;
+  h->consumer = 0;
+}
+
 void 
 HIST_add(register HIST h, int time_delta){
    register float val;

Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c	2011-02-08 22:32:33 UTC (rev 386)
+++ trunk/src/nettest_omni.c	2011-03-14 22:19:02 UTC (rev 387)
@@ -70,7 +70,16 @@
 #endif /* !defined(__VMS) */
 #include <sys/socket.h>
 #include <netinet/in.h>
+
+/* it would seem that including both <netinet/tcp.h> and <linux/tcp.h>
+   is not a path to happiness and joy when one wishes to grab tcp_info
+   stats and not get something like the compiler complaining about
+   either redefinitions, or missing tcpi_total_retrans. */
+#ifdef HAVE_LINUX_TCP_H
+#include <linux/tcp.h>
+#else
 #include <netinet/tcp.h>
+#endif
 
 #ifdef HAVE_NETINET_SCTP_H
 #include <netinet/sctp.h>
@@ -4338,6 +4347,7 @@
 {
 
   struct tcp_info tcp_info;
+
   int ret, infosize;
 
   if (protocol != IPPROTO_TCP)
@@ -4363,6 +4373,7 @@
   printf("tcpi_reordering %d tcpi_total_retrans %d\n",
 	 tcp_info.tcpi_reordering,
 	 tcp_info.tcpi_total_retrans);
+
   return;
 }
 #endif
@@ -4564,6 +4575,15 @@
     local_send_calls = 0;
     local_receive_calls = 0;
 
+    /* since we are tracking the number of outstanding requests for
+       timestamping purposes, and since the previous iteration if
+       using confidence intervals may not have completed all of them,
+       we now need to forget about them or we will mistakenly fill our
+       tracking array. raj 2011-03-14 */
+    if (keep_histogram) {
+      HIST_purge(time_hist);
+    }
+
 #ifdef WANT_FIRST_BURST
     /* we have to remember to reset the number of transactions
        outstanding and the "congestion window for each new
@@ -4862,7 +4882,7 @@
        "reliable/connection-oriented" transport (eg TCP, SCTP, etc) this
        can be either time or byte/transaction count based.  for
        unreliable transport or connection tests it can only be time
-       based.  having said that, we rely entirely on other code to
+p       based.  having said that, we rely entirely on other code to
        enforce this before we even get here. raj 2008-01-08 */
     
     if (test_time) {



More information about the netperf-dev mailing list