[netperf-dev] netperf2 commit notice r97 - in trunk: . src src/NetPerfDir src/NetServerDir

raj at netperf.org raj at netperf.org
Wed Feb 14 16:22:38 PST 2007


Author: raj
Date: 2007-02-14 16:22:33 -0800 (Wed, 14 Feb 2007)
New Revision: 97

Removed:
   trunk/src/nettest_dns.c
   trunk/src/nettest_dns.h
Modified:
   trunk/Release_Notes
   trunk/src/Makefile.am
   trunk/src/Makefile.in
   trunk/src/NetPerfDir/sources
   trunk/src/NetServerDir/sources
   trunk/src/netcpu_ntperf.c
   trunk/src/netlib.c
   trunk/src/netlib.h
   trunk/src/netperf.c
   trunk/src/netserver.c
   trunk/src/netsh.c
   trunk/src/nettest_bsd.c
Log:
flip the sense of the ifdef for ws2tcpip.h and remove DNS tests

Modified: trunk/Release_Notes
===================================================================
--- trunk/Release_Notes	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/Release_Notes	2007-02-15 00:22:33 UTC (rev 97)
@@ -2,6 +2,10 @@
 
 Things changed in this release:
 
+*) The nettest_dns.* files have been removed from the release and the
+   repository.  Those wishing to perform DNS server tests should
+   migrate to netperf4 which has better support for DNS test.
+
 *) Fixes for compiling under Windows with Mingw/gcc courtesy of Gisle
    Vanem.
 
@@ -34,10 +38,7 @@
 
 *) The nettest_ipv6.* files are no longer included in the source
    tar/zip file. IPv6 functionality has been subsumed into the
-   nettest_bsd.* files for some time now.  Paranoia keeps the Netperf
-   Contributing Editor from removing it from the top of trunk of the
-   source repository until after he can do a bit more reading about
-   subversion :)
+   nettest_bsd.* files for some time now. 
 
 *) Use a higher resolution "time" source for HISTOGRAM support under
    Windows, courtesy of Spencer Frink. Prior to this it had no better

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/Makefile.am	2007-02-15 00:22:33 UTC (rev 97)
@@ -8,7 +8,7 @@
 
 EXTRA_DIST = netcpu_none.c netcpu_looper.c netcpu_pstat.c netcpu_pstatnew.c netcpu_perfstat.c netcpu_procstat.c netcpu_kstat.c netcpu_kstat10.c netcpu_sysctl.c netcpu_ntperf.c netcpu_osx.c missing/* dirs NetPerfDir/* NetServerDir/*
 
-COMMON_SRC = hist.h netlib.c netlib.h netcpu.h netsh.c netsh.h nettest_bsd.c nettest_bsd.h nettest_dlpi.c nettest_dlpi.h nettest_dns.c nettest_dns.h nettest_unix.c nettest_unix.h nettest_xti.c nettest_xti.h nettest_sctp.c nettest_sctp.h
+COMMON_SRC = hist.h netlib.c netlib.h netcpu.h netsh.c netsh.h nettest_bsd.c nettest_bsd.h nettest_dlpi.c nettest_dlpi.h nettest_unix.c nettest_unix.h nettest_xti.c nettest_xti.h nettest_sctp.c nettest_sctp.h
 
 netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE)
 netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE)

Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/Makefile.in	2007-02-15 00:22:33 UTC (rev 97)
@@ -136,7 +136,7 @@
 
 EXTRA_DIST = netcpu_none.c netcpu_looper.c netcpu_pstat.c netcpu_pstatnew.c netcpu_perfstat.c netcpu_procstat.c netcpu_kstat.c netcpu_kstat10.c netcpu_sysctl.c netcpu_ntperf.c netcpu_osx.c missing/* dirs NetPerfDir/* NetServerDir/*
 
-COMMON_SRC = hist.h netlib.c netlib.h netcpu.h netsh.c netsh.h nettest_bsd.c nettest_bsd.h nettest_dlpi.c nettest_dlpi.h nettest_dns.c nettest_dns.h nettest_unix.c nettest_unix.h nettest_xti.c nettest_xti.h nettest_sctp.c nettest_sctp.h
+COMMON_SRC = hist.h netlib.c netlib.h netcpu.h netsh.c netsh.h nettest_bsd.c nettest_bsd.h nettest_dlpi.c nettest_dlpi.h nettest_unix.c nettest_unix.h nettest_xti.c nettest_xti.h nettest_sctp.c nettest_sctp.h
 
 netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE)
 netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE)
@@ -153,9 +153,8 @@
 PROGRAMS = $(bin_PROGRAMS)
 
 am__objects_1 = netlib.$(OBJEXT) netsh.$(OBJEXT) nettest_bsd.$(OBJEXT) \
-	nettest_dlpi.$(OBJEXT) nettest_dns.$(OBJEXT) \
-	nettest_unix.$(OBJEXT) nettest_xti.$(OBJEXT) \
-	nettest_sctp.$(OBJEXT)
+	nettest_dlpi.$(OBJEXT) nettest_unix.$(OBJEXT) \
+	nettest_xti.$(OBJEXT) nettest_sctp.$(OBJEXT)
 am__objects_2 = netcpu_ at NETCPU_SOURCE@.$(OBJEXT)
 am_netperf_OBJECTS = netperf.$(OBJEXT) $(am__objects_1) $(am__objects_2)
 netperf_OBJECTS = $(am_netperf_OBJECTS)
@@ -177,7 +176,6 @@
 @AMDEP_TRUE@	./$(DEPDIR)/netserver.Po ./$(DEPDIR)/netsh.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_bsd.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_dlpi.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/nettest_dns.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_sctp.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_unix.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_xti.Po
@@ -245,7 +243,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netsh.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_bsd.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_dlpi.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_dns.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_sctp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_unix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_xti.Po at am__quote@

Modified: trunk/src/NetPerfDir/sources
===================================================================
--- trunk/src/NetPerfDir/sources	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/NetPerfDir/sources	2007-02-15 00:22:33 UTC (rev 97)
@@ -14,7 +14,7 @@
 
 MSC_WARNING_LEVEL=/W3 /WX
 
-C_DEFINES=$(C_DEFINES) -D_CONSOLE_ -DDO_IPV6 -DHAVE_GETADDRINFO -DHAVE_GETNAMEINFO -DSTDC_HEADERS
+C_DEFINES=$(C_DEFINES) -D_CONSOLE_ -DHAVE_GETADDRINFO -DHAVE_GETNAMEINFO -DSTDC_HEADERS
 
 SOURCES= \
         ..\netcpu_ntperf.c \

Modified: trunk/src/NetServerDir/sources
===================================================================
--- trunk/src/NetServerDir/sources	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/NetServerDir/sources	2007-02-15 00:22:33 UTC (rev 97)
@@ -14,7 +14,7 @@
 
 MSC_WARNING_LEVEL=/W3 /WX
 
-C_DEFINES=$(C_DEFINES) -D_CONSOLE_ -DDO_IPV6 -DHAVE_GETADDRINFO -DHAVE_GETNAMEINFO -DSTDC_HEADERS
+C_DEFINES=$(C_DEFINES) -D_CONSOLE_ -DHAVE_GETADDRINFO -DHAVE_GETNAMEINFO -DSTDC_HEADERS
 
 SOURCES= \
         ..\netcpu_ntperf.c \

Modified: trunk/src/netcpu_ntperf.c
===================================================================
--- trunk/src/netcpu_ntperf.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/netcpu_ntperf.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -34,7 +34,9 @@
 #include <assert.h>
 
 #include <winsock2.h>
-#ifdef DO_IPV6
+// If you are trying to compile on Windows 2000 or NT 4.0 you may
+// need to define DONT_IPV6 in the "sources" files.
+#ifndef DONT_IPV6
 #include <ws2tcpip.h>
 #endif
 

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/netlib.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -105,8 +105,10 @@
 #define netperf_socklen_t socklen_t
 #include <windows.h>
 
-/* there should be another way to decide to include the ws2 file */
-#ifdef DO_IPV6
+/* the only time someone should need to define DONT_IPV6 in the
+   "sources" file is if they are trying to compile on Windows 2000 or
+   NT4 and I suspect this may not be their only problem :) */
+#ifndef DONT_IPV6
 #include <ws2tcpip.h>
 #endif
 

Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/netlib.h	2007-02-15 00:22:33 UTC (rev 97)
@@ -178,6 +178,9 @@
 #define         TCP_CC_RESPONSE            301
 #define         TCP_CC_RESULTS             302
 
+/* The DNS_RR test has been removed from netperf but we leave these
+   here for historical purposes.  Those wanting to do DNS_RR tests
+   should use netperf4 instead. */
 #define         DO_DNS_RR                  400
 #define         DNS_RR_RESPONSE            401
 #define         DNS_RR_RESULTS             402

Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/netperf.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -85,8 +85,11 @@
 #include "nettest_dlpi.h"
 #endif /* WANT_DLPI */
 
+/* The DNS tests have been removed from netperf2. Those wanting to do
+   DNS_RR tests should use netperf4 instead. */
+
 #ifdef DO_DNS
-#include "nettest_dns.h"
+#error DNS tests have been removed from netperf. Use netperf4 instead
 #endif /* DO_DNS */
 
 #ifdef WANT_SCTP

Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/netserver.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -90,9 +90,11 @@
 #include <winsock2.h>
 #define netperf_socklen_t socklen_t
 /* we need to find some other way to decide to include ws2 */
-#ifdef DO_IPV6
+/* if you are trying to compile on Windows 2000 or NT 4 you will */
+/* probably have to define DONT_IPV6 */
+#ifndef DONT_IPV6
 #include <ws2tcpip.h>
-#endif  /* DO_IPV6 */
+#endif  /* DONT_IPV6 */
 #include <windows.h>
 #define sleep(x) Sleep((x)*1000)
 #else
@@ -125,10 +127,6 @@
 #include "nettest_dlpi.h"
 #endif /* WANT_DLPI */
 
-#ifdef DO_DNS
-#include "nettest_dns.h"
-#endif /* DO_DNS */
-
 #ifdef WANT_SCTP
 #include "nettest_sctp.h"
 #endif
@@ -338,12 +336,6 @@
 
 #endif /* WANT_XTI */
 
-#ifdef DO_DNS
-    case DO_DNS_RR:
-      recv_dns_rr();
-      break;
-#endif /* DO_DNS */
-
 #ifdef WANT_SCTP
     case DO_SCTP_STREAM:
       recv_sctp_stream();

Modified: trunk/src/netsh.c
===================================================================
--- trunk/src/netsh.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/netsh.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -81,9 +81,6 @@
 #include "nettest_sctp.h"
 #endif
 
-#ifdef DO_DNS
-#include "nettest_dns.h"
-#endif /* DO_DNS */
 
 /************************************************************************/
 /*									*/
@@ -911,13 +908,6 @@
     }
 #endif
 
-#ifdef DO_DNS
-    else if (strcasecmp(test_name,"DNS_RR") == 0)
-      {
-	scan_dns_args(argc, argv);
-      }
-#endif /* DO_DNS */
-
 }
 
 

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/nettest_bsd.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -108,10 +108,11 @@
 #include <process.h>
 #define netperf_socklen_t socklen_t
 #include <winsock2.h>
-/* is ifdef DO_IPV6 the right thing here?  netperf doesn't really use
-   that any more. should this just be an arbitrary include? raj
-   2005/07/28 */ 
-#ifdef DO_IPV6
+
+/* while it is unlikely that anyone running Windows 2000 or NT 4 is
+   going to be trying to compile this, if they are they will want to
+   define DONT_IPV6 in the sources file */
+#ifndef DONT_IPV6
 #include <ws2tcpip.h>
 #endif
 #include <windows.h>

Deleted: trunk/src/nettest_dns.c
===================================================================
--- trunk/src/nettest_dns.c	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/nettest_dns.c	2007-02-15 00:22:33 UTC (rev 97)
@@ -1,939 +0,0 @@
-#ifdef DO_DNS
-#ifndef lint
-char	nettest_dns_id[]="\
-@(#)nettest_dns.c (c) Copyright 1997,2004 Hewlett-Packard Co. Version 2.2pl6";
-#else
-#define DIRTY
-#define WANT_HISTOGRAM
-#define WANT_INTERVALS
-#endif /* lint */
-
-/****************************************************************/
-/*								*/
-/*	nettest_dns.c						*/
-/*								*/
-/*      scan_dns_args()                                         */
-/*                                                              */
-/*	the actual test routines...				*/
-/*								*/
-/*	send_dns_rr()		perform a dns request/response	*/
-/*	recv_dns_rr()						*/
-/*								*/
-/****************************************************************/
-     
-
- /* For the first iteration of this suite, netperf will rely on the */
- /* gethostbyname() and gethostbyaddr() calls instead of making DNS */
- /* calls directly. Later, when there is more time, this may be */
- /* altered so that the netperf code is making the DNS requests */
- /* directly, which would mean that more of the test could be */
- /* controlled directly from netperf instead of indirectly through */
- /* config files. raj 7/97 */
-
- /* In this suite, the netserver process really is not involved, it */
- /* only measures CPU utilization over the test interval. Of course, */
- /* this presumes that the netserver process will be running on the */
- /* same machine as the DNS server :) raj 7/97 */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#ifdef NOSTDLIBH
-#include <malloc.h>
-#else /* NOSTDLIBH */
-#include <stdlib.h>
-#endif /* NOSTDLIBH */
-
-#ifndef WIN32
-#include <sys/ipc.h>
-#include <unistd.h>
-#
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netdb.h>
-#include <errno.h>
-#include <signal.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#else /* WIN32 */
-#include <process.h>
-#include <windows.h>
-#include <winsock.h>
-#include "pinc\nameser.h"
-#include "pinc\res.h"
-#include "pinc\resolv.h"
-/*#include "pinc\resolvp.h" */
-#define close(x)	closesocket(x)
-#endif /* WIN32 */
-
-#include "netlib.h"
-#include "netsh.h"
-#include "nettest_dns.h"
-
-#ifdef WANT_HISTOGRAM
-#ifdef __sgi
-#include <sys/time.h>
-#endif /* __sgi */
-#include "hist.h"
-#endif /* WANT_HISTOGRAM */
-
-
-
- /* these variables are specific to the DNS tests. declare them static */
- /* to make them global only to this file. */ 
-
-static  int confidence_iteration;
-static  char  local_cpu_method;
-static  char  remote_cpu_method;
-
-static  char  request_file[1024];
-
-static  unsigned int dns_server_addr = INADDR_ANY;
-
-#ifdef WANT_HISTOGRAM
-#ifdef HAVE_GETHRTIME
-hrtime_t time_one;
-hrtime_t time_two;
-#else
-static struct timeval time_one;
-static struct timeval time_two;
-#endif /* HAVE_GETHRTIME */
-static HIST time_hist;
-#endif /* WANT_HISTOGRAM */
-
-
-char dns_usage[] = "\n\
-Usage: netperf [global options] -- [test options] \n\
-\n\
-DNS Test Options:\n\
-    -f filename       Specify the request source file\n\
-                        Default: /tmp/netperf_dns_requests\n\
-    -h                Display this text\n\
-\n\
-For those options taking two parms, at least one must be specified;\n\
-specifying one value without a comma will set both parms to that\n\
-value, specifying a value with a leading comma will set just the second\n\
-parm, a value with a trailing comma will set just the first. To set\n\
-each parm to unique values, specify both and separate them with a\n\
-comma.\n"; 
-     
-
- /* this routine implements the client (netperf) side of the DNS_RR */
- /* test. */
-
-void
-send_dns_rr(char remote_host[])
-{
-  
-  char *tput_title = "\
-Elapsed  Transaction\n\
-Time     Rate         \n\
-Seconds  per second   \n\n";
-  
-  char *tput_fmt_0 =
-    "%7.2f\n";
-  
-  char *tput_fmt_1_line_1 = "\
-%-6.2f   %7.2f   \n";
-  char *tput_fmt_1_line_2 = "\
-%-6d %-6d\n";
-  
-  char *cpu_title = "\
-Elapsed Trans.   CPU    CPU    S.dem   S.dem\n\
-Time    Rate     local  remote local   remote\n\
-secs.   per sec  %% %c    %% %c    us/Tr   us/Tr\n\n";
-  
-  char *cpu_fmt_0 =
-    "%6.3f %c\n";
-  
-  char *cpu_fmt_1_line_1 = "\
-%-6.2f  %-6.2f  %-6.2f %-6.2f %-6.3f  %-6.3f\n";
-  
-  int			timed_out = 0;
-  float			elapsed_time;
-  
-/*   char	*temp_message_ptr; */
-  int	numtrans;
-  int	trans_remaining;
-
-  float	local_cpu_utilization;
-  float	local_service_demand;
-  float	remote_cpu_utilization;
-  float	remote_service_demand;
-  double	thruput;
-  
-  struct	hostent	        *hp;
-  unsigned      int             addr;
-
-  struct	dns_rr_request_struct	*dns_rr_request;
-  struct	dns_rr_response_struct	*dns_rr_response;
-  struct	dns_rr_results_struct	*dns_rr_result;
-  
- /* we will save the old resolver state here and then muck with the */
- /* copy. of course, if we are just going to exit anyway, I'm not sure */
- /* if we need to save the state or not :) this is slightly */
- /* complicated in that on some old systems (eg HP-UX 9.X) , the */
- /* variable type is "state", where on newer systems (eg HP-UX 10.30), */
- /* the variable type is _res_state. raj 7/97 */
-
-#ifdef __RES
-  struct __res_state saved_res;
-#else /* __RES */
-  struct state      saved_res;
-#endif /* __RES */
-
-  /* these will be parameters to res_query() at some point, they will */
-  /* come from the log file used to drive the test. for now, they will */
-  /* be hard-coded. raj 7/97 */
-
-  int           class = C_IN;  /* Internet class of resource records */
-  int           type = T_A;    /* basic host address lookup */
-  u_char        server_response[1024]; /* where the data goes */
-  int	        len = sizeof(server_response);
-
-#ifdef WANT_INTERVALS
-  int	interval_count;
-  sigset_t signal_set;
-#endif /* WANT_INTERVALS */
-
-  dns_rr_request = 
-    (struct dns_rr_request_struct *)netperf_request.content.test_specific_data;
-  dns_rr_response=
-    (struct dns_rr_response_struct *)netperf_response.content.test_specific_data;
-  dns_rr_result	=
-    (struct dns_rr_results_struct *)netperf_response.content.test_specific_data;
-
-
-  /* we need to get the IP address of the DNS server we will be */
-  /* accessing. Because it may not be possible to run netserver on the */
-  /* system acting as the DNS server, there is a test-specific option */
-  /* to specify the name/addr of the DNS server. if that is not set, */
-  /* we will use the hostname associated with the control connection. */
-  /* we want to look this information-up *before* we redirect the */
-  /* resolver libraries to the DNS SUT :) raj 7/97 */
-
-  if (dns_server_addr == INADDR_ANY) {
-    /* we use the control connection hostname as the way to find the */
-    /* IP address of the DNS SUT */
-    if ((dns_server_addr = inet_addr(remote_host)) == SOCKET_ERROR) {
-      /* it was not an IP address, try it as a name, if it was */
-      /* all-ones broadcast, we don't want to send to that anyway */
-      if ((hp = gethostbyname(remote_host)) == NULL) {
-	/* we have no idea what it is */
-	fprintf(where,
-		"send_dns_rr: could not resolve the DNS SUT %s\n",
-		remote_host);
-	fflush(where);
-	exit(1);
-      }
-      else {
-	/* it was a valid remote_host. at some point, we really need */
-	/* to worry about IPv6 addresses and such, for now simply */
-	/* assume v4 and a four byte address */
-	bcopy(hp->h_addr,
-	      (char *)&dns_server_addr,
-	      4);
-      }
-    }
-  }
-
-
-#ifdef WANT_HISTOGRAM
-  time_hist = HIST_new();
-#endif /* WANT_HISTOGRAM */
-
-  if ( print_headers ) {
-    fprintf(where,"DNS REQUEST/RESPONSE TEST");
-    fprintf(where," to %s", inet_ntoa(*(struct in_addr *)&dns_server_addr));
-    if (iteration_max > 1) {
-      fprintf(where,
-	      " : +/-%3.1f%% @ %2d%% conf.",
-	      interval/0.02,
-	      confidence_level);
-      }
-#ifdef WANT_HISTOGRAM
-    fprintf(where," : histogram");
-#endif /* WANT_HISTOGRAM */
-#ifdef WANT_INTERVALS
-    fprintf(where," : interval");
-#endif /* WANT_INTERVALS */
-    fprintf(where,"\n");
-  }
-  
-  /* initialize a few counters */
-  
-  confidence_iteration = 1;
-  init_stat();
-
-  /* we previoulsy used gethostbyname to establish the control */
-  /* connection t the netwserver. now we want to have our DNS queries */
-  /* go to the SUT, not the DNS server that got us the control */
-  /* connection information. so, we save the old resolver state (may */
-  /* not really be needed) and then set it up with the IP address of */
-  /* the DNS server we really want to access. if netperf ever goes */
-  /* threaded, this will have to be revisisted. raj 7/97 */
-
-  bcopy((char *) &_res, (char *)&saved_res, sizeof(_res));
-  
-  /* switch the state over to the test server and set the count */
-  /* correctly. there are probably other things we want to play with */
-  /* too, but those will have to wait until later. by doing this */
-  /* switch, we bypass anything in the /etc/resolv.conf file of the */
-  /* client, elminates netperf's dependency on that file being set-up */
-  /* correctly for the test. raj 7/97 */
-
-  _res.nscount = 1;
-  _res.nsaddr_list[0].sin_addr.s_addr = dns_server_addr;
-
-  /* we have a great-big while loop which controls the number of times */
-  /* we run a particular test. this is for the calculation of a */
-  /* confidence interval (I really should have stayed awake during */
-  /* probstats :). If the user did not request confidence measurement */
-  /* (no confidence is the default) then we will only go though the */
-  /* loop once. the confidence stuff originates from the folks at IBM */
-
-  while (((confidence < 0) && (confidence_iteration < iteration_max)) ||
-	 (confidence_iteration <= iteration_min)) {
-
-    /* initialize a few counters. we have to remember that we might be */
-    /* going through the loop more than once. */
-
-    numtrans        = 0;
-    times_up        = 0;
-    timed_out       = 0;
-    trans_remaining = 0;
-
-    if (debug) {
-      fprintf(where,"send_dns_rr: counter initialization complete...\n");
-    }
-  
-    /* If the user has requested cpu utilization measurements, we must */
-    /* calibrate the cpu(s). We will perform this task within the tests */
-    /* themselves. If the user has specified the cpu rate, then */
-    /* calibrate_local_cpu will return rather quickly as it will have */
-    /* nothing to do. If local_cpu_rate is zero, then we will go through */
-    /* all the "normal" calibration stuff and return the rate back.*/
-    
-    if (local_cpu_usage) {
-      local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
-    }
-    
-    /* Tell the remote end to get ready. All the netserver side really */
-    /* does in this test is measure CPU utilization. raj 7/97 */
-    
-    netperf_request.content.request_type =	DO_DNS_RR;
-    dns_rr_request->measure_cpu	         =	remote_cpu_usage;
-    dns_rr_request->cpu_rate	         =	remote_cpu_rate;
-    if (test_time) {
-      dns_rr_request->test_length	 =	test_time;
-    }
-    else {
-      /* the DNS tests only support running for a length of time, so */
-      /* if the user requested a number of transactions, we must abort */
-      /* and tell him why. raj 7/97 */
-      fprintf(where,
-	      "netperf send_dns_rr: test length must be a time\n");
-      fflush(where);
-      exit(1);
-    }
-    
-    if (debug > 1) {
-      fprintf(where,"netperf: send_dns_rr: requesting DNS rr test\n");
-    }
-    
-    send_request();
-    
-    /* The response from the remote will contain all of the relevant 	*/
-    /* parameters for this test type. We will put them back into the */
-    /* variables here so they can be displayed if desired.  The	remote */
-    /* will have calibrated CPU if necessary, and will have done all */
-    /* the needed set-up we will have calibrated the cpu locally */
-    /* before sending the request, and will grab the counter value */
-    /* right after the response returns. The remote will grab the */
-    /* counter right after the response is sent. This is about as */
-    /* close as we can get them - we trust that the delta will be */
-    /* sufficiently small. raj 7/97 */
-  
-    recv_response();
-  
-    if (!netperf_response.content.serv_errno) {
-      remote_cpu_usage  = dns_rr_response->measure_cpu;
-      remote_cpu_rate   = dns_rr_response->cpu_rate;
-      if (debug) {
-	fprintf(where,"remote listen done.\n");
-	fprintf(where," cpu_rate %g\n",remote_cpu_rate);
-	fflush(where);
-      }
-    }
-    else {
-      Set_errno(netperf_response.content.serv_errno);
-      fprintf(where,
-	      "netperf: remote error %d",
-	      netperf_response.content.serv_errno);
-      perror("");
-      fflush(where);
-      
-      exit(1);
-    }
-    
-    /* Set-up the test end conditions. For a DNS_RR test, this can */
-    /* only be time based, and that was checked earlier. raj 7/97 */
-    
-    times_up = 0;
-    start_timer(test_time);
-    
-    /* The cpu_start routine will grab the current time and possibly */
-    /* value of the idle counter for later use in measuring cpu */
-    /* utilization and/or service demand and thruput. */
-    
-    cpu_start(local_cpu_usage);
-
-#ifdef WANT_INTERVALS
-    if ((interval_burst) || (demo_mode)) {
-      /* zero means that we never pause, so we never should need the */
-      /* interval timer, unless we are in demo_mode */
-      start_itimer(interval_wate);
-    }
-    interval_count = interval_burst;
-    /* get the signal set for the call to sigsuspend */
-    if (sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &signal_set) != 0) {
-      fprintf(where,
-	      "send_dns_rr: unable to get sigmask errno %d\n",
-	      errno);
-      fflush(where);
-      exit(1);
-    }
-#endif /* WANT_INTERVALS */
-    
-    while (!times_up) {
-      
-#ifdef WANT_HISTOGRAM
-      /* timestamp just before our call to  gethostbyname or */
-      /* gethostbyaddr, and then again just  after the call. raj 7/97 */
-      HIST_timestamp(&time_one);
-#endif /* WANT_HISTOGRAM */
-      
-      /* until we implement the file, just request a fixed name. the */
-      /* file will include what we are to request, and an indication */
-      /* of whether or not it was supposed to "work" or "fail" at that */
-      /* point we will learn how to interpret the server's response */
-      /* raj 7/97 */
-      
-      /* we use res_query because we may be looking for just about */
-      /* anything, and we do not want to be controlled in any way by */
-      /* the client's nsswitch file. */
-      if (res_query("hpindio.cup.hp.com",
-		    class,
-		    type,
-		    server_response,
-		    len) == -1) {
-	fprintf(where,
-		"send_dns_rr: res_query failed. errno %d\n",
-		errno);
-	fflush(where);
-      }
-
-#ifdef WANT_HISTOGRAM
-      HIST_timestamp(&time_two);
-      HIST_add(time_hist,delta_micro(&time_one,&time_two));
-#endif /* WANT_HISTOGRAM */
-#ifdef WANT_INTERVALS      
-      if (demo_mode) {
-	units_this_tick += 1;
-      }
-      /* in this case, the interval count is the count-down couter */
-      /* to decide to sleep for a little bit */
-      if ((interval_burst) && (--interval_count == 0)) {
-	/* call sigsuspend and wait for the interval timer to get us */
-	/* out */
-	if (debug) {
-	  fprintf(where,"about to suspend\n");
-	  fflush(where);
-	}
-	if (sigsuspend(&signal_set) == EFAULT) {
-	  fprintf(where,
-		  "send_udp_rr: fault with signal set!\n");
-	  fflush(where);
-	  exit(1);
-	}
-	interval_count = interval_burst;
-      }
-#endif /* WANT_INTERVALS */
-      
-      numtrans++;          
-      
-      if (debug > 3) {
-	if ((numtrans % 100) == 0) {
-	  fprintf(where,
-		  "Transaction %d completed\n",
-		  numtrans);
-	  fflush(where);
-	}
-      }
-    }
-
-    /* this call will always give us the elapsed time for the test, and */
-    /* will also store-away the necessaries for cpu utilization */
-    
-    cpu_stop(local_cpu_usage,&elapsed_time);	/* was cpu being */
-						/* measured? how long */
-						/* did we really run? */
-    
-    /* Get the statistics from the remote end. The remote will have */
-    /* calculated CPU utilization. If it wasn't supposed to care, it */
-    /* will return obvious values. */ 
-    
-    recv_response();
-    if (!netperf_response.content.serv_errno) {
-      if (debug) {
-	fprintf(where,"remote results obtained\n");
-	fprintf(where,
-		"remote elapsed time %g\n",dns_rr_result->elapsed_time);
-	fprintf(where,
-		"remote cpu util %g\n",dns_rr_result->cpu_util);
-	fprintf(where,
-		"remote num cpu %g\n",dns_rr_result->num_cpus);
-	fflush(where);
-      }
-		
-    }
-    else {
-      Set_errno(netperf_response.content.serv_errno);
-      fprintf(where,"netperf: remote error %d",
-	      netperf_response.content.serv_errno);
-      perror("");
-      fflush(where);
-      exit(1);
-    }
-    
-    /* We now calculate what our throughput was for the test. */
-  
-    thruput	= numtrans/elapsed_time;
-  
-    /* for this test, the remote CPU util is really the only */
-    /* interesting one - although I guess one can consider the local */
-    /* CPU util as giving an idea if the client saturated before the */
-    /* server */
-
-    if (local_cpu_usage || remote_cpu_usage) {
-      /* We must now do a little math for service demand and cpu */
-      /* utilization for the system(s) */
-      /* Of course, some of the information might be bogus because */
-      /* there was no idle counter in the kernel(s). We need to make */
-      /* a note of this for the user's benefit...*/
-      if (local_cpu_usage) {
-	local_cpu_utilization = calc_cpu_util(0.0);
-	/* since calc_service demand is doing ms/Kunit we will */
-	/* multiply the number of transaction by 1024 to get */
-	/* "good" numbers */
-	local_service_demand  = calc_service_demand((double) numtrans*1024,
-						    0.0,
-						    0.0,
-						    0);
-      }
-      else {
-	local_cpu_utilization	= (float) -1.0;
-	local_service_demand	= (float) -1.0;
-      }
-      
-      if (remote_cpu_usage) {
-	remote_cpu_utilization = dns_rr_result->cpu_util;
-	/* since calc_service demand is doing ms/Kunit we will */
-	/* multiply the number of transaction by 1024 to get */
-	/* "good" numbers */
-	remote_service_demand = calc_service_demand((double) numtrans*1024,
-						    0.0,
-						    remote_cpu_utilization,
-						    dns_rr_result->num_cpus);
-      }
-      else {
-	remote_cpu_utilization = (float) -1.0;
-	remote_service_demand  = (float) -1.0;
-      }
-      
-    }
-    else {
-      /* we were not measuring cpu, for the confidence stuff, we */
-      /* should make it -1.0 */
-      local_cpu_utilization	= (float) -1.0;
-      local_service_demand	= (float) -1.0;
-      remote_cpu_utilization = (float) -1.0;
-      remote_service_demand  = (float) -1.0;
-    }
-
-    /* at this point, we want to calculate the confidence information. */
-    /* if debugging is on, calculate_confidence will print-out the */
-    /* parameters we pass it */
-    
-    calculate_confidence(confidence_iteration,
-			 elapsed_time,
-			 thruput,
-			 local_cpu_utilization,
-			 remote_cpu_utilization,
-			 local_service_demand,
-			 remote_service_demand);
-    
-    
-    confidence_iteration++;
-
-  }
-
-  retrieve_confident_values(&elapsed_time,
-			    &thruput,
-			    &local_cpu_utilization,
-			    &remote_cpu_utilization,
-			    &local_service_demand,
-			    &remote_service_demand);
-
-  /* We are now ready to print all the information. If the user */
-  /* has specified zero-level verbosity, we will just print the */
-  /* local service demand, or the remote service demand. If the */
-  /* user has requested verbosity level 1, he will get the basic */
-  /* "streamperf" numbers. If the user has specified a verbosity */
-  /* of greater than 1, we will display a veritable plethora of */
-  /* background information from outside of this block as it it */
-  /* not cpu_measurement specific...  */
-
-  if (confidence < 0) {
-    /* we did not hit confidence, but were we asked to look for it? */
-    if (iteration_max > 1) {
-      display_confidence();
-    }
-  }
-
-  if (local_cpu_usage || remote_cpu_usage) {
-    local_cpu_method = format_cpu_method(cpu_method);
-    remote_cpu_method = format_cpu_method(dns_rr_result->cpu_method);
-    
-    switch (verbosity) {
-    case 0:
-      if (local_cpu_usage) {
-	fprintf(where,
-		cpu_fmt_0,
-		local_service_demand,
-		local_cpu_method);
-      }
-      else {
-	fprintf(where,
-		cpu_fmt_0,
-		remote_service_demand,
-		remote_cpu_method);
-      }
-      break;
-    case 1:
-    case 2:
-      if (print_headers) {
-	fprintf(where,
-		cpu_title,
-		local_cpu_method,
-		remote_cpu_method);
-      }
-
-      fprintf(where,
-	      cpu_fmt_1_line_1,		/* the format string */
-	      elapsed_time,		/* how long was the test */
-	      thruput,
-	      local_cpu_utilization,	/* local cpu */
-	      remote_cpu_utilization,	/* remote cpu */
-	      local_service_demand,	/* local service demand */
-	      remote_service_demand);	/* remote service demand */
-      break;
-    }
-  }
-  else {
-    /* The tester did not wish to measure service demand. */
-    
-    switch (verbosity) {
-    case 0:
-      fprintf(where,
-	      tput_fmt_0,
-	      thruput);
-      break;
-    case 1:
-    case 2:
-      if (print_headers) {
-	fprintf(where,tput_title,format_units());
-      }
-
-      fprintf(where,
-	      tput_fmt_1_line_1,	/* the format string */
-	      elapsed_time, 		/* how long did it take */
-	      thruput);
-      
-      break;
-    }
-  }
-  
-  /* it would be a good thing to include information about some of the */
-  /* other parameters that may have been set for this test, but at the */
-  /* moment, I do not wish to figure-out all the  formatting, so I will */
-  /* just put this comment here to help remind me that it is something */
-  /* that should be done at a later time. */
-  
-  /* how to handle the verbose information in the presence of */
-  /* confidence intervals is yet to be determined... raj 11/94 */
-  if (verbosity > 1) {
-
-#ifdef WANT_HISTOGRAM
-    fprintf(where,"\nHistogram of request/response times\n");
-    fflush(where);
-    HIST_report(time_hist);
-#endif /* WANT_HISTOGRAM */
-
-  }
-  
-}
-
-
- /* this routine implements the receive (netserver) side of a DNS_RR */
- /* test */
-void
-recv_dns_rr()
-{
-  
-  int	timed_out = 0;
-  float	elapsed_time;
-  
-  struct	dns_rr_request_struct	*dns_rr_request;
-  struct	dns_rr_response_struct	*dns_rr_response;
-  struct	dns_rr_results_struct	*dns_rr_results;
-  
-  dns_rr_request = 
-    (struct dns_rr_request_struct *)netperf_request.content.test_specific_data;
-  dns_rr_response =
-    (struct dns_rr_response_struct *)netperf_response.content.test_specific_data;
-  dns_rr_results =
-    (struct dns_rr_results_struct *)netperf_response.content.test_specific_data;
-  
-  if (debug) {
-    fprintf(where,"netserver: recv_dns_rr: entered...\n");
-    fflush(where);
-  }
-  
-  /* If anything goes wrong, we want the remote to know about it. It */
-  /* would be best if the error that the remote reports to the user is */
-  /* the actual error we encountered, rather than some bogus unexpected */
-  /* response type message. */
-  
-  if (debug) {
-    fprintf(where,"recv_dns_rr: setting the response type...\n");
-    fflush(where);
-  }
-  
-  netperf_response.content.response_type = DNS_RR_RESPONSE;
-  
-  if (debug) {
-    fprintf(where,"recv_dns_rr: the response type is set...\n");
-    fflush(where);
-  }
-  
-  netperf_response.content.serv_errno   = 0;
-  
-  /* But wait, there's more. If the initiator wanted cpu measurements, */
-  /* then we must call the calibrate routine, which will return the max */
-  /* rate back to the initiator. If the CPU was not to be measured, or */
-  /* something went wrong with the calibration, we will return a 0.0 to */
-  /* the initiator. */
-  
-  dns_rr_response->cpu_rate = (float)0.0; 	/* assume no cpu */
-  dns_rr_response->measure_cpu = 0;
-
-  if (dns_rr_request->measure_cpu) {
-    dns_rr_response->measure_cpu = 1;
-    dns_rr_response->cpu_rate = calibrate_local_cpu(dns_rr_request->cpu_rate);
-  }
-  
-  
-  /* before we send the response back to the initiator, pull some of */
-  /* the socket parms from the globals */
-  dns_rr_response->test_length = dns_rr_request->test_length;
-  send_response();
-  
- /* the WIN32 stuff needs fleshing-out */
-#ifdef WIN32
-  /* this is used so the timer thread can close the socket out from */
-  /* under us, which to date is the easiest/cleanest/least */
-  /* Windows-specific way I can find to force the winsock calls to */
-  /* return WSAEINTR with the test is over. anything that will run on */
-  /* 95 and NT and is closer to what netperf expects from Unix signals */
-  /* and such would be appreciated raj 1/96 */
-
-  /*+*+SAF Unfortunately, there is no s_data socket to close out in the DNS API case... */
-  /*+*+ SAF win_kludge_socket = s_data; */
-#endif /* WIN32 */
-
-  if (debug) {
-    fprintf(where,"recv_dns_rr: initial response sent.\n");
-    fflush(where);
-  }
-  
-  /* Now it's time to first grab the apropriate counters */
-  
-  cpu_start(dns_rr_request->measure_cpu);
-  
-  /* The loop will exit when we hit the end of the test time */
-  
-  times_up = 0;
-
-#ifndef WIN32
-  start_timer(dns_rr_request->test_length + PAD_TIME);
-
-  /* since we know that a signal will be coming, we use pause() here. */
-  /* using sleep leads to a premature exit that messes-up the CPU */
-  /* utilization figures. raj 7/97 */
-  
-  pause();
-  
-  /* The loop now exits due to timeout or transaction count being */
-  /* reached */
-  
-  cpu_stop(dns_rr_request->measure_cpu,&elapsed_time);
-  
-  stop_timer();
-#else
-
-  {
-    HANDLE hSleep = INVALID_HANDLE_VALUE;
-	DWORD ErrorCode;
-
-	/* Create the dummy "Sleep" event object */
-	hSleep = CreateEvent( 
-		(LPSECURITY_ATTRIBUTES) NULL,	  /* no security */
-		TRUE,	 /* manual reset event */
-		FALSE,   /* init. state = reset */
-		(void *)NULL);  /* unnamed event object */
-	if (hSleep == (HANDLE) INVALID_HANDLE_VALUE)
-	{
-		perror("CreateEvent failure");
-		exit(1);
-	}
-
-	/* Wait on this event (which will never be signaled) for test_length + PAD_TIME seconds. */
-
-	ErrorCode = WaitForSingleObject(hSleep, (dns_rr_request->test_length + PAD_TIME)*1000);  /*Lint */
-	if (ErrorCode == WAIT_FAILED)
-	{
-		perror("WaitForSingleObject failed");
-		exit(1);
-	}
-
-  }  
-  /* The loop now exits due to timeout or transaction count being */
-  /* reached */
-  
-  cpu_stop(dns_rr_request->measure_cpu,&elapsed_time);
-#endif  /* WIN32 */
-
-  /* we ended the test by time, which was at least 2 seconds */
-  /* longer than we wanted to run. so, we want to subtract */
-  /* PAD_TIME from the elapsed_time. */
-  elapsed_time -= PAD_TIME;
-
-  /* send the results to the sender			*/
-  
-  dns_rr_results->elapsed_time   = elapsed_time;
-  dns_rr_results->cpu_method     = cpu_method;
-  dns_rr_results->num_cpus       = lib_num_loc_cpus;
-  if (dns_rr_request->measure_cpu) {
-    dns_rr_results->cpu_util	= calc_cpu_util(elapsed_time);
-  }
-  
-  if (debug) {
-    fprintf(where,
-	    "recv_dns_rr: test complete, sending results.\n");
-    fflush(where);
-  }
-  
-  send_response();
-  
-}
-
-
-void
-print_dns_usage()
-{
-
-  fwrite(dns_usage, sizeof(char), strlen(dns_usage), stdout);
-  exit(1);
-
-}
-void
-scan_dns_args(int argc, char *argv[])
-{
-#define DNS_ARGS "f:hH:"
-  extern char	*optarg;	  /* pointer to option string	*/
-  
-  int		c;
-  
-  char	
-    arg1[BUFSIZ],  /* argument holders		*/
-    arg2[BUFSIZ];
-  
-  struct hostent *hp;
-
-  if (no_control) {
-    fprintf(where,
-	    "The DNS tests do not know how to run with no control connection\n");
-    exit(-1);
-  }
-
-  /* Go through all the command line arguments and break them */
-  /* out. For those options that take two parms, specifying only */
-  /* the first will set both to that value. Specifying only the */
-  /* second will leave the first untouched. To change only the */
-  /* first, use the form "first," (see the routine break_args.. */
-  
-  while ((c= getopt(argc, argv, DNS_ARGS)) != EOF) {
-    switch (c) {
-    case '?':	
-    case 'h':
-      print_dns_usage();
-      exit(1);
-    case 'f':
-      /* this is the name of the log file from which we pick what to */
-      /* request */
-      strcpy(request_file,optarg);
-
-      if (debug) {
-	fprintf(where,"Will take DNS names from %s\n",optarg);
-	fflush(where);
-      }
-      
-      break;
-    case 'H':
-      /* someone wishes to specify the DNS server as being different */
-      /* from the endpoint of the control connection */
-
-      if ((dns_server_addr = inet_addr(optarg)) == SOCKET_ERROR) {
-	/* it was not an IP address, try it as a name, if it was */
-	/* all-ones broadcast, we don't want to send to that anyway */
-	if ((hp = gethostbyname(optarg)) == NULL) {
-	  /* we have no idea what it is */
-	  fprintf(where,
-		  "scan_dns_args: could not resolve the DNS SUT %s\n",
-		  optarg);
-	  fflush(where);
-	  exit(1);
-	}
-	else {
-	  /* it was a valid remote_host. at some point, we really need */
-	  /* to worry about IPv6 addresses and such, for now simply */
-	  /* assume v4 and a four byte address */
-	  bcopy(hp->h_addr,
-		(char *)&dns_server_addr,
-		4);
-	}
-      }
-
-      break;
-    };
-  }
-}
-#endif /* DO_DNS */

Deleted: trunk/src/nettest_dns.h
===================================================================
--- trunk/src/nettest_dns.h	2007-02-14 23:47:03 UTC (rev 96)
+++ trunk/src/nettest_dns.h	2007-02-15 00:22:33 UTC (rev 97)
@@ -1,48 +0,0 @@
-/*
-        Copyright (C) 1997,2004 Hewlett-Packard Company
-*/
-
- /* This file contains the test-specific definitions for netperf's DNS */
- /* performance tests */
-
- /* For the first iteration of this suite, netperf will rely on the */
- /* gethostbyname() and gethostbyaddr() calls instead of making DNS */
- /* calls directly. Later, when there is more time, this may be */
- /* altered so that the netperf code is making the DNS requests */
- /* directly, which would mean that more of the test could be */
- /* controlled directly from netperf instead of indirectly through */
- /* config files. */
-
- /* In this suite, the netserver process really is not involved, it */
- /* only measures CPU utilization over the test interval. Of course, */
- /* this presumes that the netserver process will be running on the */
- /* same machine as the DNS server :) raj 7/97 */
-
-struct	dns_rr_request_struct {
-  int	measure_cpu;	/* does the client want server cpu	*/
-  float	cpu_rate;	/* do we know how fast the cpu is?	*/
-  int	test_length;	/* how long is the test?		*/
-};
-
-struct	dns_rr_response_struct {
-  int	measure_cpu;	/* does the client want server cpu	*/
-  int	test_length;	/* how long is the test?		*/
-  float	cpu_rate;		/* could we measure	*/
-};
-
-struct dns_rr_results_struct {
-  float	        elapsed_time;	/* how long the test ran */
-  float	        cpu_util;	/* -1 if not measured */
-  float	        serv_dem;	/* -1 if not measured */
-  int           cpu_method;    /* how was cpu util measured? */
-  int           num_cpus;      /* how many CPUs had the remote? */
-};
-
-extern void scan_dns_args(int argc, char *argv[]);
-
-extern void send_dns_rr(char remote_host[]);
-
-extern void recv_dns_rr();
-
-extern void loc_cpu_rate();
-extern void rem_cpu_rate();



More information about the netperf-dev mailing list