[netperf-dev] netperf2 commit notice r414 - in trunk: . src

raj at netperf.org raj at netperf.org
Thu Jul 7 12:10:57 PDT 2011


Author: raj
Date: 2011-07-07 12:10:57 -0700 (Thu, 07 Jul 2011)
New Revision: 414

Modified:
   trunk/config.h.in
   trunk/configure
   trunk/configure.ac
   trunk/src/netlib.c
   trunk/src/nettest_bsd.c
Log:
pretty up the code a bit

Modified: trunk/config.h.in
===================================================================
--- trunk/config.h.in	2011-07-01 16:05:20 UTC (rev 413)
+++ trunk/config.h.in	2011-07-07 19:10:57 UTC (rev 414)
@@ -214,6 +214,9 @@
 /* Define to 1 if you have the <sys/ioctl.h> header file. */
 #undef HAVE_SYS_IOCTL_H
 
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#undef HAVE_SYS_IPC_H
+
 /* Define to 1 if you have the <sys/mman.h> header file. */
 #undef HAVE_SYS_MMAN_H
 

Modified: trunk/configure
===================================================================
--- trunk/configure	2011-07-01 16:05:20 UTC (rev 413)
+++ trunk/configure	2011-07-07 19:10:57 UTC (rev 414)
@@ -4560,7 +4560,7 @@
 done
 
 
-for ac_header in arpa/inet.h endian.h errno.h fcntl.h limits.h malloc.h netdb.h netinet/in.h signal.h stdlib.h string.h strings.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h unistd.h ifaddrs.h sys/sockio.h sys/sysinfo.h syscall.h netinet/sctp.h linux/tcp.h
+for ac_header in arpa/inet.h endian.h errno.h fcntl.h limits.h malloc.h netdb.h netinet/in.h signal.h stdlib.h string.h strings.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h unistd.h ifaddrs.h sys/ipc.h sys/sockio.h sys/sysinfo.h syscall.h netinet/sctp.h linux/tcp.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2011-07-01 16:05:20 UTC (rev 413)
+++ trunk/configure.ac	2011-07-07 19:10:57 UTC (rev 414)
@@ -36,7 +36,7 @@
 # Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([arpa/inet.h endian.h errno.h fcntl.h limits.h malloc.h netdb.h netinet/in.h signal.h stdlib.h string.h strings.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h unistd.h ifaddrs.h sys/sockio.h sys/sysinfo.h syscall.h netinet/sctp.h linux/tcp.h])
+AC_CHECK_HEADERS([arpa/inet.h endian.h errno.h fcntl.h limits.h malloc.h netdb.h netinet/in.h signal.h stdlib.h string.h strings.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h unistd.h ifaddrs.h sys/ipc.h sys/sockio.h sys/sysinfo.h syscall.h netinet/sctp.h linux/tcp.h])
 
 # Some platforms require these.  There may be a better way.
 AC_HAVE_LIBRARY(socket)

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2011-07-01 16:05:20 UTC (rev 413)
+++ trunk/src/netlib.c	2011-07-07 19:10:57 UTC (rev 414)
@@ -819,11 +819,10 @@
 
   if (temp_cpus > MAXCPUS) {
     fprintf(where,
-            "Sorry, this system has more CPUs (%d) than I can handle (%d).\n",
+            "Sorry, this system has more CPUs (%d) than I can handle (%d).\n"
+            "Please alter MAXCPUS in netlib.h and recompile.\n",
             temp_cpus,
             MAXCPUS);
-    fprintf(where,
-            "Please alter MAXCPUS in netlib.h and recompile.\n");
     fflush(where);
     exit(1);
   }
@@ -1118,10 +1117,11 @@
 #endif /* SA_INTERRUPT */
 
   if (sigaction(SIGALRM, &action, NULL) < 0) {
-    fprintf(where,"start_timer: error installing alarm handler ");
-    fprintf(where,"errno %d\n",errno);
+    fprintf(where,
+	    "start_timer: error installing alarm handler errno %d\n",
+	    errno);
     fflush(where);
-    exit(1);
+    exit(-1);
   }
 
   /* this is the easy case - just set the timer for so many seconds */ 
@@ -1132,6 +1132,7 @@
 	    ret,
             errno);
     fflush(where);
+    exit(-1);
   }
 #endif /* WIN32 */
 
@@ -1197,10 +1198,10 @@
   }
 
   if (debug) {
-    fprintf(where,"setting the interval timer to %d sec %d usec ",
+    fprintf(where,
+	    "setting the interval timer to %d sec %d usec test len %d ticks\n",
             usec_per_itvl / 1000000,
-            usec_per_itvl % 1000000);
-    fprintf(where,"test len %d ticks\n",
+            usec_per_itvl % 1000000,
             test_len_ticks);
     fflush(where);
   }
@@ -1326,12 +1327,10 @@
 
   if (debug) {
     fprintf(where,
-            "netlib_init: request_array at %p\n",
-            request_array);
-    fprintf(where,
+            "netlib_init: request_array at %p\n"
             "netlib_init: response_array at %p\n",
+            request_array,
             response_array);
-
     fflush(where);
   }
 
@@ -1457,8 +1456,10 @@
     /* get the ring element */
     temp_link = (struct ring_elt *)malloc(sizeof(struct ring_elt));
     if (temp_link == NULL) {
-      printf("malloc(%u) failed!\n", (unsigned int)sizeof(struct ring_elt));
-      exit(1);
+      fprintf(where,
+	      "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 */
     if (i == 1) {
@@ -1466,9 +1467,11 @@
     }
     temp_link->buffer_base = (char *)malloc(malloc_size);
     if (temp_link == NULL) {
-      printf("malloc(%d) failed!\n", malloc_size);
-      exit(1);
-	}
+      fprintf(where,
+	      "malloc(%d) failed!\n",
+	      malloc_size);
+      exit(-1);
+    }
 
 #ifndef WIN32
     temp_link->buffer_ptr = (char *)(( (long)(temp_link->buffer_base) + 
@@ -1614,7 +1617,8 @@
     assert (width >= 1);
 
     if (debug) {
-        fprintf (where, "allocate_exs_buffer_ring: "
+        fprintf (where,
+		 "allocate_exs_buffer_ring: "
                  "width=%d buffer_size=%d alignment=%d offset=%d\n",
                  width, buffer_size, alignment, offset);
     }
@@ -1630,7 +1634,8 @@
     }
     mmap_buffer_aligned = (char *) ((uintptr_t)mmap_buffer & ~(NBPG-1));
     if (debug) {
-        fprintf (where, "allocate_exs_buffer_ring: "
+        fprintf (where,
+		 "allocate_exs_buffer_ring: "
                  "mmap buffer size=%d address=0x%p aligned=0x%p\n",
                  mmap_size, mmap_buffer, mmap_buffer_aligned);
     }
@@ -1696,7 +1701,7 @@
         prev_link = temp_link;
     }
 
-    return (first_link);        /* it's a circle, doesn't matter which we return */
+    return (first_link);  /* it is a circle, doesn't matter which we return */
 }
 
 #endif /* HAVE_ICSC_EXS */
@@ -1805,8 +1810,9 @@
     }
     if (statbuf.st_size < (width * buffer_size)) {
       /* the file is too short */
-      fprintf(stderr,"alloc_sendfile_buf_ring: specified file too small.\n");
-      fprintf(stderr,"file must be larger than send_width * send_size\n");
+      fprintf(stderr,
+	      "alloc_sendfile_buf_ring: specified file too small.\n"
+	      "file must be larger than send_width * send_size\n");
       fflush(stderr);
       exit(1);
     }
@@ -1825,9 +1831,11 @@
     temp_link = (struct sendfile_ring_elt *)
       malloc(sizeof(struct sendfile_ring_elt));
     if (temp_link == NULL) {
-      printf("malloc(%u) failed!\n",(unsigned int) sizeof(struct sendfile_ring_elt));
+      fprintf(where,
+	      "malloc(%u) failed!\n",
+	      (unsigned int) sizeof(struct sendfile_ring_elt));
       exit(1);
-	}
+    }
 
     /* remember the first one so we can close the ring at the end */
 
@@ -2943,25 +2951,23 @@
   struct addrinfo *temp;
   temp=info;
 
-  fprintf(dumploc, "getaddrinfo returned the following for host '%s' ", host);
-  fprintf(dumploc, "port '%s' ", port);
-  fprintf(dumploc, "family %s\n", inet_ftos(family));
+  fprintf(dumploc,
+	  "getaddrinfo returned the following for host '%s' port '%s' "
+	  " family %s\n",
+	  host,
+	  port,
+	  inet_ftos(family));
+
   while (temp) {
     /* seems that Solaris 10 GA bits will not give a canonical name
        for ::0 or 0.0.0.0, and their fprintf() cannot deal with a null
        pointer, so we have to check for a null pointer.  probably a
        safe thing to do anyway, eventhough it was not necessary on
        linux or hp-ux. raj 2005-02-09 */
-    if (temp->ai_canonname) {
-      fprintf(dumploc,
-	      "\tcannonical name: '%s'\n",temp->ai_canonname);
-    }
-    else {
-      fprintf(dumploc,
-	      "\tcannonical name: '%s'\n","(nil)");
-    }
     fprintf(dumploc,
+	    "\tcannonical name: '%s'\n"
             "\tflags: %x family: %s: socktype: %s protocol %s addrlen %d\n",
+	    (temp->ai_canonname) ? temp->ai_canonname : "(nil)",
             temp->ai_flags,
             inet_ftos(temp->ai_family),
             inet_ttos(temp->ai_socktype),
@@ -3025,11 +3031,11 @@
   } while ((error == EAI_AGAIN) && (count <= 5));
 
   if (error) {
-    printf("establish control: could not resolve host '%s' port '%s' af %s",
+    printf("establish control: could not resolve host '%s' port '%s' af %s"
+	   "\n\tgetaddrinfo returned %d %s\n",
            hostname,
            port,
-           inet_ftos(family));
-    printf("\n\tgetaddrinfo returned %d %s\n",
+           inet_ftos(family),
            error,
            gai_strerror(error));
     return(NULL);
@@ -3090,12 +3096,11 @@
 
   if (debug) {
     fprintf(where,
-            "establish_control called with host '%s' port '%s' remfam %s\n",
+            "establish_control called with host '%s' port '%s' remfam %s\n"
+            "\t\tlocal '%s' port '%s' locfam %s\n",
             hostname,
             port,
-            inet_ftos(remfam));
-    fprintf(where,
-            "\t\tlocal '%s' port '%s' locfam %s\n",
+            inet_ftos(remfam),
             localhost,
             localport,
             inet_ftos(locfam));
@@ -3160,10 +3165,10 @@
 	/* the connect call failed */
 	if (debug) {
 	  fprintf(where,
-		  "establish_control: connect failed, errno %d %s\n",
+		  "establish_control: connect failed, errno %d %s\n"
+		  "    trying next address combination\n",
 		  errno,
 		  strerror(errno));
-	  fprintf(where, "    trying next address combination\n");
 	  fflush(where);
 	}
       }
@@ -3172,10 +3177,10 @@
       /* the bind failed */
       if (debug) {
 	fprintf(where,
-		"establish_control: bind failed, errno %d %s\n",
+		"establish_control: bind failed, errno %d %s\n"
+		"    trying next address combination\n",
 		errno,
 		strerror(errno));
-	fprintf(where, "    trying next address combination\n");
 	fflush(where);
       }
     }
@@ -3201,7 +3206,11 @@
 
   /* so, we are either connected or not */
   if (not_connected) {
-    fprintf(where, "establish control: are you sure there is a netserver listening on %s at port %s?\n",hostname,port);
+    fprintf(where,
+	    "establish control: are you sure there is a netserver "
+	    "listening on %s at port %s?\n",
+	    hostname,
+	    port);
     fflush(where);
     return(INVALID_SOCKET);
   }
@@ -3228,7 +3237,9 @@
 					      locfam);
   if (netlib_control == INVALID_SOCKET) {
     fprintf(where,
-	    "establish_control could not establish the control connection from %s port %s address family %s to %s port %s address family %s\n",
+	    "establish_control could not establish the control"
+	    " connection from %s port %s address family %s to %s"
+	    " port %s address family %s\n",
 	    localhost,localport,inet_ftos(locfam),
 	    hostname,port,inet_ftos(remfam));
     fflush(where);
@@ -3546,13 +3557,14 @@
   double thruput;
 
   if (debug) {
-    fprintf(where,"calc_service_demand called:  units_sent = %f\n",
-            units_sent);
-    fprintf(where,"                             elapsed_time = %f\n",
-            elapsed_time);
-    fprintf(where,"                             cpu_util = %f\n",
-            cpu_utilization);
-    fprintf(where,"                             num cpu = %d\n",
+    fprintf(where,
+	    "calc_service_demand called:  units_sent = %f\n"
+	    "                             elapsed_time = %f\n"
+	    "                             cpu_util = %f\n"
+	    "                             num cpu = %d\n",
+            units_sent,
+            elapsed_time,
+            cpu_utilization,
             num_cpus);
     fflush(where);
   }
@@ -3584,17 +3596,18 @@
     (float) num_cpus;
   
   if (debug) {
-    fprintf(where,"calc_service_demand using:   units_sent = %f\n",
-            units_sent);
-    fprintf(where,"                             elapsed_time = %f\n",
-            elapsed_time);
-    fprintf(where,"                             cpu_util = %f\n",
-            cpu_utilization);
-    fprintf(where,"                             num cpu = %d\n",
-            num_cpus);
-    fprintf(where,"calc_service_demand got:     thruput = %f\n",
-            thruput);
-    fprintf(where,"                             servdem = %f\n",
+    fprintf(where,
+	    "calc_service_demand using:   units_sent = %f\n"
+	    "                             elapsed_time = %f\n"
+	    "                             cpu_util = %f\n"
+	    "                             num cpu = %d\n"
+	    "calc_service_demand got:     thruput = %f\n"
+	    "                             servdem = %f\n",
+            units_sent,
+            elapsed_time,
+            cpu_utilization,
+            num_cpus,
+            thruput,
             service_demand);
     fflush(where);
   }
@@ -4354,16 +4367,14 @@
 
   if (debug) {
     fprintf(where,
-            "calculate_confidence: itr  %d; time %f; res  %f\n",
+            "calculate_confidence: itr  %d; time %f; res  %f\n"
+            "                               lcpu %f; rcpu %f\n"
+            "                               lsdm %f; rsdm %f\n",
             confidence_iterations,
             time,
-            result);
-    fprintf(where,
-            "                               lcpu %f; rcpu %f\n",
+            result,
             loc_cpu,
-            rem_cpu);
-    fprintf(where,
-            "                               lsdm %f; rsdm %f\n",
+            rem_cpu,
             loc_sd,
             rem_sd);
     fflush(where);
@@ -4516,25 +4527,17 @@
 
 {
   fprintf(where,
-          "!!! WARNING\n");
-  fprintf(where,
-          "!!! Desired confidence was not achieved within ");
-  fprintf(where,
-          "the specified iterations.\n");
-  fprintf(where,
-          "!!! This implies that there was variability in ");
-  fprintf(where,
-          "the test environment that\n");
-  fprintf(where,
-          "!!! must be investigated before going further.\n");
-  fprintf(where,
-          "!!! Confidence intervals: Throughput      : %4.3f%%\n",
-          100.0 * (interval - result_confid));
-  fprintf(where,
-          "!!!                       Local CPU util  : %4.3f%%\n",
-          100.0 * (interval - loc_cpu_confid));
-  fprintf(where,
+          "!!! WARNING\n"
+          "!!! Desired confidence was not achieved within "
+          "the specified iterations.\n"
+          "!!! This implies that there was variability in "
+          "the test environment that\n"
+          "!!! must be investigated before going further.\n"
+          "!!! Confidence intervals: Throughput      : %4.3f%%\n"
+          "!!!                       Local CPU util  : %4.3f%%\n"
           "!!!                       Remote CPU util : %4.3f%%\n\n",
+          100.0 * (interval - result_confid),
+          100.0 * (interval - loc_cpu_confid),
           100.0 * (interval - rem_cpu_confid));
 }
 

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2011-07-01 16:05:20 UTC (rev 413)
+++ trunk/src/nettest_bsd.c	2011-07-07 19:10:57 UTC (rev 414)
@@ -775,12 +775,11 @@
 
   if (error) {
     fprintf(where,
-	    "complete_addrinfo: could not resolve '%s' port '%s' af %d",
+	    "complete_addrinfo: could not resolve '%s' port '%s' af %d"
+	    "\n\tgetaddrinfo returned %d %s\n",
 	    hostname,
 	    port,
-	    family);
-    fprintf(where,
-	    "\n\tgetaddrinfo returned %d %s\n",
+	    family,
 	    error,
 	    gai_strerror(error));
     fflush(where);
@@ -831,10 +830,8 @@
       !(change_warning_displayed & CHANGED_SOCK_TYPE)) {
     change_warning_displayed |= CHANGED_SOCK_TYPE;
     fprintf(where,
-	    "WARNING! getaddrinfo returned a socket type which did not\n");
-    fprintf(where,
-	    "match the requested type.  Please contact your vendor for\n");
-    fprintf(where,
+	    "WARNING! getaddrinfo returned a socket type which did not\n"
+	    "match the requested type.  Please contact your vendor for\n"
 	    "a fix to this bug in getaddrinfo()\n");
     fflush(where);
   }
@@ -846,18 +843,17 @@
      this behaviour we will only emit this warning if debug is set
      under Solaris and will continue to emit it under any circumstance
      on other platforms should it arise. raj 2009-06-03 */
+  /* since it has now been two years since that bug was filed, it
+     should be resolved by now, so the "out" given to Sun should no
+     longer be necessary.  either folks are running with the fix or
+     they need to get the fix. raj 2011-07-06 */
   if ((change_info & CHANGED_PROTOCOL) &&
       !(change_warning_displayed & CHANGED_PROTOCOL) &&
-#ifdef __sun
-      (debug) &&
-#endif
       (hints.ai_protocol != 0)) {
     change_warning_displayed |= CHANGED_PROTOCOL;
     fprintf(where,
-	    "WARNING! getaddrinfo returned a protocol other than the\n");
-    fprintf(where,
-	    "requested protocol.  Please contact your vendor for\n");
-    fprintf(where,
+	    "WARNING! getaddrinfo returned a protocol other than the\n"
+	    "requested protocol.  Please contact your vendor for\n"
 	    "a fix to this bug in getaddrinfo()\n");
     fflush(where);
   }
@@ -866,8 +862,7 @@
       !(change_warning_displayed & CHANGED_SCTP)) {
     change_warning_displayed |= CHANGED_SCTP;
     fprintf(where,
-	    "WARNING! getaddrinfo on this platform does not accept IPPROTO_SCTP!\n");
-    fprintf(where,
+	    "WARNING! getaddrinfo on this platform does not accept IPPROTO_SCTP!\n"
 	    "Please contact your vendor for a fix to this bug in getaddrinfo().\n");
     fflush(where);
   }
@@ -876,8 +871,7 @@
       !(change_warning_displayed & CHANGED_DCCP)) {
     change_warning_displayed |= CHANGED_DCCP;
     fprintf(where,
-	    "WARNING! getaddrinfo on this platform does not accept IPPROTO_DCCP!\n");
-    fprintf(where,
+	    "WARNING! getaddrinfo on this platform does not accept IPPROTO_DCCP!\n"
 	    "Please contact your vendor for a fix to this bug in getaddrinfo().\n");
     fflush(where);
   }



More information about the netperf-dev mailing list