[netperf-dev] netperf4 commit notice r88 - trunk/src

burger at netperf.org burger at netperf.org
Mon Mar 20 13:48:34 PST 2006


Author: burger
Date: 2006-03-20 13:48:31 -0800 (Mon, 20 Mar 2006)
New Revision: 88

Modified:
   trunk/src/disktest.c
   trunk/src/disktest.h
   trunk/src/netlib.c
   trunk/src/netlib_hpux.c
   trunk/src/netperf.h
   trunk/src/netperf_docs.dtd
   trunk/src/netperf_hist.h
   trunk/src/nettest_bsd.c
   trunk/src/nettest_dns.c
   trunk/src/nettest_vst.c
Log:
Fix problem in netlib_hpux.c referencing tid because of glib thread_id change.

Added histogram routines to netlib.c
Modified netperf_hist.h to make things work.
Tested histogram code with disktest
Modified nettest_bsd.c, nettest_dns.c and nettest_vst.c and made sure
they would compile if WANT_HISTOGRAM was defined.
Added a hist_stats element to netperf_docs.dtd so histogram stats can
be passed back to netperf for reporting.  Currently only disktest has
a complete report routine which will report histogram data.

Stephen Burger



Modified: trunk/src/disktest.c
===================================================================
--- trunk/src/disktest.c	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/disktest.c	2006-03-20 21:48:31 UTC (rev 88)
@@ -32,19 +32,8 @@
 #ifndef lint
 char    disk_test_id[]="\
 @(#)disktest.c (c) Copyright 2005 Hewlett-Packard Co. $Id: disktest.c 20 2006-2-28 19:45:00Z burger $";
-#else
-#define WANT_HISTOGRAM
 #endif /* lint */
 
-#ifdef WANT_HISTOGRAM
-#define HISTOGRAM_VARS        struct timeval time_one,time_two
-#define HIST_TIMESTAMP(time)  gettimeofday(time,NULL)
-#define HIST_ADD(h,delta)     HIST_add(h,delta)
-#else
-#define HISTOGRAM_VARS       /* variable declarations for histogram go here */
-#define HIST_TIMESTAMP(time) /* time stamp call for histogram goes here */
-#define HIST_ADD(h,delta)    /* call to add data to histogram goes here */
-#endif
 
 /****************************************************************/
 /*                                                              */
@@ -57,6 +46,10 @@
 
 
 
+/* turn on histogram capability */
+#define WANT_HISTOGRAM
+
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -409,6 +402,9 @@
     fprintf(test->where, "\n");
     fflush(test->where);
   }
+  
+  new_data->read_hist  = HIST_new();
+  new_data->write_hist = HIST_new();
 
   SET_TEST_DATA(test, new_data);
 }
@@ -465,6 +461,7 @@
 disk_test_get_stats(test_t *test)
 {
   xmlNodePtr  stats = NULL;
+  xmlNodePtr  hist  = NULL;
   xmlAttrPtr  ap    = NULL;
   int         i,j;
   char        value[32];
@@ -480,7 +477,7 @@
   }
   if ((stats = xmlNewNode(NULL,(xmlChar *)"test_stats")) != NULL) {
     /* set the properites of the test_stats message -
-       the tid and time stamps/values and counter values  sgb 2004-07-07 */
+       the tid and time stamps/values and counter values  sgb 2006-03-15 */
 
     ap = xmlSetProp(stats,(xmlChar *)"tid",test->id);
     for (i = 0; i < DISK_MAX_COUNTERS; i++) {
@@ -540,6 +537,17 @@
         }
       }
     }
+    /* add hist_stats entries to the status report */
+    hist = HIST_stats_node(my_data->read_hist, "DISK READ");
+    if (hist != NULL) {
+      fprintf(test->where, "Adding Histogram child\n");
+      fflush(test->where);
+      xmlAddChild(stats,hist);
+    }
+    hist = HIST_stats_node(my_data->write_hist, "DISK WRITE");
+    if (hist != NULL) {
+      xmlAddChild(stats,hist);
+    }
     if (ap == NULL) {
       xmlFreeNode(stats);
       stats = NULL;
@@ -941,8 +949,10 @@
     if (readIO) {
       bytes = io_read(fd, buf_addr, size, test, (char *)__func__);
       if (state == TEST_MEASURE) {
-        HIST_TIMESTAMP(&time_two);
-        HIST_ADD(my_data->read_hist,delta_macro(&time_one,&time_two));
+        if (my_data->read_hist) {
+          HIST_TIMESTAMP(&time_two);
+          HIST_ADD(my_data->read_hist, &time_one, &time_two);
+        }
         my_data->stats.named.read_calls++;
         my_data->stats.named.bytes_read += bytes;
       }
@@ -950,8 +960,10 @@
     else {
       bytes = io_write(fd, buf_addr, size, test, (char *)__func__);
       if (state == TEST_MEASURE) {
-        HIST_TIMESTAMP(&time_two);
-        HIST_ADD(my_data->write_hist,delta_macro(&time_one,&time_two));
+        if (my_data->write_hist) {
+          HIST_TIMESTAMP(&time_two);
+          HIST_ADD(my_data->write_hist, &time_one, &time_two);
+        }
         my_data->stats.named.write_calls++;
         my_data->stats.named.bytes_written += bytes;
       }
@@ -1239,6 +1251,24 @@
   rd->write_iops[index]      += write_call_rate;
   rd->iops[index]            += iops;
 
+  fprintf(outfd,"%s:print_hist=%d  print_test=%d  print_run=%d\n",
+          __func__, rd->print_hist, rd->print_test, rd->print_run);
+  fflush(outfd);
+  if (rd->print_hist) {
+    xmlNodePtr  hist;
+    hist = stats->xmlChildrenNode;
+    if (hist == NULL) {
+      fprintf(outfd,"%s:No Histogram Node Found\n\n",__func__);
+      fflush(outfd);
+    }
+    while (hist != NULL) {
+      if (!xmlStrcmp(hist->name,(const xmlChar *)"hist_stats")) {
+        HIST_REPORT(outfd, hist);
+      }
+      hist = hist->next;
+    }
+  }
+
   if (rd->print_test) {
     /* Display per test results */
     fprintf(outfd,"%3d  ", count);                    /*  0,5 */
@@ -1259,17 +1289,17 @@
 static double
 process_sys_stats(tset_t *test_set, xmlNodePtr stats, xmlChar *tid)
 {
-  int            i;
-  int            count;
-  int            index;
-  FILE          *outfd;
+  int             i;
+  int             count;
+  int             index;
+  FILE           *outfd;
   disk_results_t *rd;
-  double         elapsed_seconds;
-  double         sys_util;
-  double         calibration;
-  double         local_idle;
-  double         local_busy;
-  double         local_cpus;
+  double          elapsed_seconds;
+  double          sys_util;
+  double          calibration;
+  double          local_idle;
+  double          local_busy;
+  double          local_cpus;
 
 #define MAX_SYS_CNTRS 10
 #define E_SEC         0
@@ -1337,6 +1367,34 @@
     fflush(test_set->where);
   }
   rd->utilization[index]  += local_busy;
+
+  if (rd->print_per_cpu) {
+    xmlNodePtr  cpu;
+    char       *value_str;
+
+    cpu = stats->xmlChildrenNode;
+    while (cpu != NULL) {
+      if (!xmlStrcmp(cpu->name,(const xmlChar *)"per_cpu_stats")) {
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"cpu_id");
+        fprintf(outfd,"  cpu%2s ", value_str);
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"calibration");
+        fprintf(outfd,"%s ", value_str);
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"idle_count");
+        fprintf(outfd,"%s ", value_str);
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"user_count");
+        fprintf(outfd,"%s ", value_str);
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"sys_count");
+        fprintf(outfd,"%s ", value_str);
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"int_count");
+        fprintf(outfd,"%s ", value_str);
+        value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"other_count");
+        fprintf(outfd,"%s\n", value_str);
+        fflush(outfd);
+      }
+      cpu = cpu->next;
+    }
+  }
+
   if (rd->print_test) {
     /* Display per test results */
     fprintf(outfd,"%3d  ", count);                    /*  0,5 */

Modified: trunk/src/disktest.h
===================================================================
--- trunk/src/disktest.h	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/disktest.h	2006-03-20 21:48:31 UTC (rev 88)
@@ -69,6 +69,7 @@
 typedef struct  disk_results_data {
   int     max_count;
   int     print_hist;
+  int     print_per_cpu;
   int     print_test;
   int     print_run;
   FILE   *outfd;

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/netlib.c	2006-03-20 21:48:31 UTC (rev 88)
@@ -137,10 +137,246 @@
 extern test_hash_t test_hash[TEST_HASH_BUCKETS];
 extern tset_hash_t test_set_hash[TEST_SET_HASH_BUCKETS];
 
-#define HIST  void*
+#include "hist.h"
 
-#include "nettest_bsd.h"
+HIST
+HIST_new(void){
+  HIST h;
+  h = (HIST) malloc(sizeof(struct histogram_struct));
+  if (h) {
+    HIST_clear(h);
+  }
+  return h;
+}
 
+void
+HIST_clear(HIST h){
+  int i;
+  for(i = 0; i < 10; i++){
+#ifdef HAVE_GETHRTIME
+    h->hundred_nsec[i] = 0;
+#endif
+    h->unit_usec[i] = 0;
+    h->ten_usec[i] = 0;
+    h->hundred_usec[i] = 0;
+    h->unit_msec[i] = 0;
+    h->ten_msec[i] = 0;
+    h->hundred_msec[i] = 0;
+    h->unit_sec[i] = 0;
+    h->ten_sec[i] = 0;
+  }
+  h->ridiculous = 0;
+  h->total = 0;
+}
+
+#ifdef HAVE_GETHRTIME
+
+void
+HIST_add_nano(register HIST h, hrtime_t *begin, hrtime_t *end)
+{
+  register int64_t val;
+
+  val = (*end) - (*begin);
+  h->total++;
+  val = val/100;
+  if (val <= 9) h->hundred_nsec[val]++;
+  else {
+    val = val/10;
+    if (val <= 9) h->unit_usec[val]++;
+    else {
+      val = val/10;
+      if (val <= 9) h->ten_usec[val]++;
+      else {
+        val = val/10;
+        if (val <= 9) h->hundred_usec[val]++;
+        else {
+          val = val/10;
+          if (val <= 9) h->unit_msec[val]++;
+          else {
+            val = val/10;
+            if (val <= 9) h->ten_msec[val]++;
+            else {
+              val = val/10;
+              if (val <= 9) h->hundred_msec[val]++;
+              else {
+                val = val/10;
+                if (val <= 9) h->unit_sec[val]++;
+                else {
+                  val = val/10;
+                  if (val <= 9) h->ten_sec[val]++;
+                  else h->ridiculous++;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+#endif
+
+
+void
+HIST_add(register HIST h, int time_delta)
+{
+  register int val;
+  h->total++;
+  val = time_delta;
+  if(val <= 9) h->unit_usec[val]++;
+  else {
+    val = val/10;
+    if(val <= 9) h->ten_usec[val]++;
+    else {
+      val = val/10;
+      if(val <= 9) h->hundred_usec[val]++;
+      else {
+        val = val/10;
+        if(val <= 9) h->unit_msec[val]++;
+        else {
+          val = val/10;
+          if(val <= 9) h->ten_msec[val]++;
+          else {
+            val = val/10;
+            if(val <= 9) h->hundred_msec[val]++;
+            else {
+              val = val/10;
+              if(val <= 9) h->unit_sec[val]++;
+              else {
+                val = val/10;
+                if(val <= 9) h->ten_sec[val]++;
+                else h->ridiculous++;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+
+static xmlAttrPtr
+set_hist_attribute(xmlNodePtr hist, char *name, int *row)
+{
+  int         i,j;
+  xmlAttrPtr  ap   = NULL;
+  char        values[256];
+  
+  values[0] = 0;
+  for (i = 0, j = 0; i < 10; i++) {
+    j += snprintf(&(values[j]), 256-j, ":%5d", row[i]);
+  }
+  ap = xmlSetProp(hist, (xmlChar *)name, (xmlChar *)values);
+  return(ap);
+}
+
+
+xmlNodePtr
+HIST_stats_node(HIST h, char *name)
+{
+  int         i,j;
+  xmlNodePtr  hist;
+  xmlAttrPtr  ap;
+  char        value_str[32];
+  
+
+  if ((hist = xmlNewNode(NULL,(xmlChar *)"hist_stats")) != NULL) {
+    ap = xmlSetProp(hist, (xmlChar *)"hist_name", (xmlChar *)name);
+#ifdef HAVE_GETHRTIME
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "hundred_nsec", h->hundred_nsec);
+    }
+#endif
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "unit_usec", h->unit_usec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "ten_usec", h->ten_usec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "hundred_usec", h->hundred_usec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "unit_msec", h->unit_msec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "ten_msec", h->ten_msec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "hundred_msec", h->hundred_msec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "unit_sec", h->unit_sec);
+    }
+    if (ap != NULL) {
+      ap = set_hist_attribute(hist, "ten_sec", h->ten_sec);
+    }
+    if (ap != NULL) {
+      sprintf(value_str,": %4d",h->ridiculous);
+      ap = xmlSetProp(hist, (xmlChar *)"plus_100_sec", (xmlChar *)value_str);
+    }
+    if (ap != NULL) {
+      sprintf(value_str,": %4lld",h->total);
+      ap = xmlSetProp(hist, (xmlChar *)"hist_total", (xmlChar *)value_str);
+    }
+    if (ap == NULL) {
+      xmlFreeNode(hist);
+      hist = NULL;
+    }
+  }
+  return(hist);
+}
+
+
+void
+HIST_report(FILE *fd, xmlNodePtr hist)
+{
+   int         i;
+   xmlChar    *string;
+   
+   string = xmlGetProp(hist, (const xmlChar *)"hist_name");
+   fprintf(fd, "\nHISTOGRAM REPORT for %s\n", string);
+   fprintf(fd, "              ");
+   for (i=0; i<10; i++) {
+     fprintf(fd, ":%5d",i);
+   }
+   fprintf(fd, "\n");
+   fprintf(fd, "--------------");
+   for (i=0; i<10; i++) {
+     fprintf(fd, "+-----");
+   }
+   fprintf(fd, "\n");
+   string = xmlGetProp(hist, (const xmlChar *)"hundred_nsec");
+   if (string) {
+     fprintf(fd, "HUNDRED_NSEC  %s\n", string);
+   }
+   string = xmlGetProp(hist, (const xmlChar *)"unit_usec");
+   fprintf(fd, "UNIT_USEC     %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"ten_usec");
+   fprintf(fd, "TEN_USEC      %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"hundred_usec");
+   fprintf(fd, "HUNDRED_USEC  %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"unit_msec");
+   fprintf(fd, "UNIT_MSEC     %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"ten_msec");
+   fprintf(fd, "TEN_MSEC      %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"hundred_msec");
+   fprintf(fd, "HUNDRED_MSEC  %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"unit_sec");
+   fprintf(fd, "UNIT_SEC      %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"ten_sec");
+   fprintf(fd, "TEN_SEC       %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"plus_100_sec");
+   fprintf(fd, "100_PLUS_SEC  %s\n", string);
+   string = xmlGetProp(hist, (const xmlChar *)"hist_total");
+   fprintf(fd, "HIST_TOTAL    %s\n", string);
+   fprintf(fd, "\n");
+   fflush(fd);
+}
+
+
 #ifndef PATH_MAX
 #define PATH_MAX MAX_PATH
 #endif
@@ -191,6 +427,14 @@
   *timestamp = gethrtime();
 }
 
+uint64_t
+delta_nano(hrtime_t *begin, hrtime_t *end)
+{
+  int64_t nsecs;
+  nsecs = (*end) - (*begin);
+  return(nsecs);
+}
+
 int
 delta_micro(hrtime_t *begin, hrtime_t *end)
 {
@@ -424,7 +668,6 @@
 void
 report_test_status(test_t *test)
 {
-  bsd_data_t  *my_data;
   char        current[8];
   char        requested[8];
   char        reported[8];

Modified: trunk/src/netlib_hpux.c
===================================================================
--- trunk/src/netlib_hpux.c	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/netlib_hpux.c	2006-03-20 21:48:31 UTC (rev 88)
@@ -68,19 +68,19 @@
              PTHREAD_BIND_FORCED_NP,
              &spu,
              value,
-             test->tid);
+             test->thread_id);
   }
   else if (strcmp(loc_type,"LDOM") == 0) {
     err  = pthread_ldom_bind_np(
              &ldom,
              value,
-             test->tid);
+             test->thread_id);
   }
   else if (strcmp(loc_type,"PSET") == 0) {
     err  = pthread_pset_bind_np(
              &pset,
              value,
-             test->tid);
+             test->thread_id);
   }
   if (err) {
     if (err == EINVAL) {

Modified: trunk/src/netperf.h
===================================================================
--- trunk/src/netperf.h	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/netperf.h	2006-03-20 21:48:31 UTC (rev 88)
@@ -106,11 +106,7 @@
 #error Netperf4 requires either glib or pthreads
 #endif
 
-#ifdef WANT_HISTOGRAM
 #include "netperf_hist.h"
-#else
-#define HIST  void*
-#endif
 
 #ifdef WIN32
 #define NETPERF_DEBUG_LOG_DIR "c:\\temp\\"

Modified: trunk/src/netperf_docs.dtd
===================================================================
--- trunk/src/netperf_docs.dtd	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/netperf_docs.dtd	2006-03-20 21:48:31 UTC (rev 88)
@@ -9,22 +9,25 @@
 
 <!-- default entity definitions these may be changed as desired -->
 
-<!ENTITY % default.family	'"AF_INET"' >
-<!ENTITY % default.host		'"localhost"' >
-<!ENTITY % default.npservice	'"netperf4"' >
-<!ENTITY % default.tstservice	'"0"' >
-<!ENTITY % default.socksize	'"32"' >
-<!ENTITY % default.msgsize     	'"4"' >
-<!ENTITY % default.units     	'"KB"' >
-<!ENTITY % default.reqsize     	'"1"' >
-<!ENTITY % default.rspsize     	'"1"' >
-<!ENTITY % default.width     	'"0"' >
-<!ENTITY % default.align     	'"8"' >
-<!ENTITY % default.offset     	'"0"' >
-<!ENTITY % default.no_delay    	'"0"' >
+<!ENTITY % default.family                  '"AF_INET"' >
+<!ENTITY % default.host                    '"localhost"' >
+<!ENTITY % default.npservice               '"netperf4"' >
+<!ENTITY % default.tstservice              '"0"' >
+<!ENTITY % default.socksize                '"32"' >
+<!ENTITY % default.msgsize                 '"4"' >
+<!ENTITY % default.units                   '"KB"' >
+<!ENTITY % default.reqsize                 '"1"' >
+<!ENTITY % default.rspsize                 '"1"' >
+<!ENTITY % default.width                   '"0"' >
+<!ENTITY % default.align                   '"8"' >
+<!ENTITY % default.offset                  '"0"' >
+<!ENTITY % default.no_delay                '"0"' >
+<!ENTITY % default.disk_io_size            '"8"' >
+<!ENTITY % default.disk_io_units           '"KB"' >
+<!ENTITY % default.disk_test_size          '"4"' >
+<!ENTITY % default.disk_test_units         '"MB"' >
 
 
-     
 <!-- Changeing the definition of any configuration file entity or element
      below this comment may require a code change.  sgb 2003-10-11 -->
 
@@ -162,8 +165,8 @@
   port		CDATA	#REQUIRED
 >
 
-<!ELEMENT test ((dependson | dependency_data)?, (socket_args | unknown )?,
-                 (dns_args)? ) >
+<!ELEMENT test ((dependson | dependency_data)?,
+                ((socket_args , (dns_args)?) | disk_args | unknown )? ) >
 <!ATTLIST test
   xmlns           CDATA   #FIXED    "http://www.netperf.org/ns/netperf"
   tid             ID      #REQUIRED
@@ -199,6 +202,7 @@
      system specific.  If locality_value is not specified no binding occurs.
      If an invalid locality_value is specified no binding occurs. -->
 
+
 <!ELEMENT unknown (#PCDATA) >
 
 <!ELEMENT version EMPTY >
@@ -328,17 +332,6 @@
   tid           ID      #REQUIRED
 >
 
-<!-- if output_file is not specified output defaults to stdout -->
-<!-- The attributes command_file and output_file are for a looped tests -->
-<!-- The attributes interval and confidence are for checking confidence
-     for reported test results.  min_count must be specified to check
-     confidence. -->
-<!-- Interval is the desired percentage range around the mean for which
-     the confidence level is calculated.   example 0.05 is mean +/- 2.5%
-     The default value for interval is 0.05  -->
-<!-- confidence is the desired confidence level which measured results
-     fall within the interval around the reported measured mean. 
-     The default value for confidence is 99% -->
 
 <!ELEMENT report_stats (
   (clear_stats) |
@@ -364,7 +357,18 @@
   interval      CDATA   #IMPLIED
   confidence  (50 | 70 | 80 | 90 | 95 | 98 | 99 | 99.8 | 99.9) #IMPLIED
 >
+<!-- If attribute output_file is not specified output defaults to stdout -->
+<!-- The attributes interval and confidence are for checking confidence
+     for reported test results.  min_count must be specified and must be
+     >1 to check confidence. -->
+<!-- Interval is the desired percentage range around the mean for which
+     the confidence level is calculated.   example 0.05 is mean +/- 2.5%
+     The default value for interval is 0.05  -->
+<!-- confidence is the desired confidence level which measured results
+     fall within the interval around the reported measured mean. 
+     The default value for confidence is 99% -->
 
+
 <!ELEMENT snap EMPTY >
 <!ATTLIST snap tid  IDREF  "t_all" >
 
@@ -402,7 +406,8 @@
   other_count    CDATA   #IMPLIED
 >
 
-<!ELEMENT test_stats ( #PCDATA ) >
+
+<!ELEMENT test_stats ( #PCDATA | hist_stats)* >
 <!ATTLIST test_stats 
   tid            ID      #REQUIRED
   elapsed_sec    CDATA   #IMPLIED
@@ -443,6 +448,22 @@
   infoF_value    CDATA   #IMPLIED
 >
 
+<!ELEMENT hist_stats EMPTY >
+<!ATTLIST hist_stats
+  hist_name      CDATA   #REQUIRED
+  hundred_nsec   CDATA   #REQUIRED
+  unit_usec      CDATA   #REQUIRED
+  ten_usec       CDATA   #REQUIRED
+  hundred_usec   CDATA   #REQUIRED
+  unit_msec      CDATA   #REQUIRED
+  ten_msec       CDATA   #REQUIRED
+  hundred_msec   CDATA   #REQUIRED
+  unit_sec       CDATA   #REQUIRED
+  ten_sec        CDATA   #REQUIRED
+  plus_100_sec   CDATA   #REQUIRED
+  hist_total     CDATA   #REQUIRED
+>
+  
 
 <!ELEMENT socket_args EMPTY >
 <!ATTLIST socket_args
@@ -471,12 +492,65 @@
   recv_offset       CDATA    %default.offset;
 >
 
+
 <!ELEMENT dns_args EMPTY >
 <!ATTLIST dns_args
   max_outstanding   CDATA    #IMPLIED
   timeout           CDATA    #IMPLIED
 >
                       
+
+<!-- Element definitions for Disk Tests -->
+
+<!ELEMENT disk_args EMPTY >
+<!ATTLIST disk_args
+  file_name         CDATA    #REQUIRED
+  read              CDATA    #IMPLIED
+  disk_io_size      CDATA                 %default.disk_io_size;
+  disk_io_units     ( KB | MB | GB)       %default.disk_io_units;
+  disk_test_size    CDATA                 %default.disk_test_size;
+  disk_test_units   ( KB | MB | GB)       %default.disk_test_units;
+  start             CDATA    #IMPLIED
+  stop              CDATA    #IMPLIED
+  scsi_immreport    (0 | 1)  #IMPLIED
+  scsi_queue_depth  CDATA    #IMPLIED
+>
+
+<!-- read
+     Specifies the ratio of reads to all I/Os.  Valid values 1.0 to 0.0.
+     For sequential I/O tests any non-zero value defaults to read only.
+     Default value is 1.0 when no value is specified. -->
+<!-- disk_io_size
+     The size in disk_io_units of each read/write to the file.
+     Must have at maximum value of disk test size in bytes / 2.
+     Default value is smaller of 8K or disk test size in bytes / 2
+     when no value is specified.  DTD specifies default of 8KB. -->
+<!-- disk_io_units
+     Default value of 1024 bytes. -->
+<!-- disk_test_size
+     The size in disk_test_units of the file to access.
+     Default value is smaller of 512*chunk or max_file_size-start_position
+     when no value is specified. DTD specifies default of 4MB. -->
+<!-- disk_test_units
+     Default value of 1024 * 1024 bytes. -->
+<!-- start_position
+     KByte offset within the file at which to start I/O.
+     Raw I/O will be rounded to a sector boundary if sector size > 1KB.
+     Default value is 0 when no value is specified. -->
+<!-- end_position
+     Maximum KByte offset within the file.
+     Will always be defaulted for sequential I/O tests.
+     Default value when no value is specified is
+     start_position + (size converted to KB)
+     or maximum_file_size which ever is smaller. -->
+<!-- scsi_immreport
+     Specifies the value to which scsi_immreport will be set.
+     If not specified the test will not change the current value. -->
+<!-- scsi_queue_depth
+     Specifies the value to which scsi_queue_depth will be set.
+     If not specified the test will not change the current value. -->
+
+
 <!-- Element definitions for variable sized data tests  -->
 
 <!ELEMENT work_load_description (pattern, distribution?)* >

Modified: trunk/src/netperf_hist.h
===================================================================
--- trunk/src/netperf_hist.h	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/netperf_hist.h	2006-03-20 21:48:31 UTC (rev 88)
@@ -31,6 +31,7 @@
 
 */
 
+
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
@@ -41,12 +42,51 @@
 #  include <time.h>
 # endif
 #endif
+#ifdef IRIX
+#include <sys/time.h>
+#endif /* IRIX */
 
+#if !defined(NETLIB) && !defined(WANT_HISTOGRAM)
+
+#define HISTOGRAM_VARS       /* variable declarations for histogram go here */
+#define HIST_TIMESTAMP(time) /* time stamp call for histogram goes here */
+#define HIST_ADD(h,t1,t2)    /* call to add data to histogram goes here */
+#define HIST_STATS_NODE(h,n) /* call to get hist statistics node goes here */
+#define HIST_REPORT(fd,h)    /* call to report histogram data goes here */
+
+#define HIST_NEW()           NULL
+
+typedef void *HIST;
+
+#else
+
+#ifdef WANT_HISTOGRAM
+
+#ifdef HAVE_GETHRTIME
+#define HISTOGRAM_VARS        hrtime_t time_one,time_two
+#define HIST_ADD(h,t1,t2)     HIST_add_nano(h,t1,t2)
+#else
+#define HISTOGRAM_VARS        struct timeval time_one,time_two
+#define HIST_ADD(h,t1,t2)     HIST_add(h,delta_micro(t1,t2))
+#endif
+
+#define HIST_TIMESTAMP(time)  netperf_timestamp(time)
+#define HIST_NEW()            HIST_new()
+#define HIST_STATS_NODE(h,n)  HIST_stats_node(h,n)
+#define HIST_REPORT(fd,h)     HIST_report(fd,h)
+
+typedef void *HIST;
+
+#endif
+
+#ifdef NETLIB
+
 /* hist.h
 
-   Given a time difference in microseconds, increment one of 81
+   Given a time difference in microseconds, increment one of 91
    different buckets: 
    
+   0 - 9 in increments of 100 nsecs
    0 - 9 in increments of 1 usec
    0 - 9 in increments of 10 usecs
    0 - 9 in increments of 100 usecs
@@ -64,63 +104,76 @@
    
    Colin Low  10/6/93
    Rick Jones 2004-06-15 - extend to 1 and 10 usec
+   Stephen Burger 2006-03-17 - extend to 100 nsec
 */
-#ifndef _HIST_INCLUDED
-#define _HIST_INCLUDED
 
-#ifdef IRIX
-#include <sys/time.h>
-#endif /* IRIX */
-   
 struct histogram_struct {
-  int unit_usec[10];
-  int ten_usec[10];
-  int hundred_usec[10];
-  int unit_msec[10];
-  int ten_msec[10];
-  int hundred_msec[10];
-  int unit_sec[10];
-  int ten_sec[10];
-  int ridiculous;
-  int total;
+  int      hundred_nsec[10];
+  int      unit_usec[10];
+  int      ten_usec[10];
+  int      hundred_usec[10];
+  int      unit_msec[10];
+  int      ten_msec[10];
+  int      hundred_msec[10];
+  int      unit_sec[10];
+  int      ten_sec[10];
+  int      ridiculous;
+  int64_t  total;
 };
 
 typedef struct histogram_struct *HIST;
 
+#endif
+
+#ifndef _HIST_INCLUDED
+#define _HIST_INCLUDED
+   
 /* 
    HIST_new - return a new, cleared histogram data type
 */
 
-HIST HIST_new(void); 
+extern HIST HIST_new(void); 
 
 /* 
    HIST_clear - reset a histogram by clearing all totals to zero
 */
 
-void HIST_clear(HIST h);
+extern void HIST_clear(HIST h);
 
 /*
    HIST_add - add a time difference to a histogram. Time should be in
    microseconds. 
 */
 
-void HIST_add(register HIST h, int time_delta);
+#ifdef HAVE_GETHRTIME
+extern void HIST_add_nano(register HIST h, hrtime_t *begin, hrtime_t *end);
+#else
+extern void HIST_add(register HIST h, int time_delta);
+#endif
 
 /* 
+  HIST_stats_node - create a histogram statistics xml node to report 
+  on the contents of a histogram. Second parameter is a descriptive
+  name to be reported with the histogram.
+*/
+
+extern xmlNodePtr HIST_stats_node(HIST h, char *name);
+
+/* 
   HIST_report - create an ASCII report on the contents of a histogram.
-  Currently printsto standard out 
+  prints to file fd the histogram statistics in the xml node.
 */
 
-void HIST_report(HIST h);
+extern void HIST_report(FILE *fd, xmlNodePtr h);
 
 /*
-  HIST_timestamp - take a timestamp suitable for use in a histogram.
+  netperf_timestamp - take a timestamp suitable for use in a histogram.
 */
 
 #ifdef HAVE_GETHRTIME
-void HIST_timestamp(hrtime_t *timestamp);
+extern void netperf_timestamp(hrtime_t *timestamp);
 #else
-void HIST_timestamp(struct timeval *timestamp);
+extern void netperf_timestamp(struct timeval *timestamp);
 #endif
 
 /*
@@ -132,12 +185,14 @@
   limited to WANT_HISTOGRAM?  raj 2005-12-09
 */
 #ifdef HAVE_GETHRTIME
-int delta_micro(hrtime_t *begin, hrtime_t *end);
-int delta_milli(hrtime_t *begin, hrtime_t *end);
+extern int delta_micro(hrtime_t *begin, hrtime_t *end);
+extern int delta_milli(hrtime_t *begin, hrtime_t *end);
 #else
-int delta_micro(struct timeval *begin, struct timeval *end);
-int delta_milli(struct timeval *begin, struct timeval *end);
+extern int delta_micro(struct timeval *begin, struct timeval *end);
+extern int delta_milli(struct timeval *begin, struct timeval *end);
 #endif
 
 #endif
 
+#endif
+

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/nettest_bsd.c	2006-03-20 21:48:31 UTC (rev 88)
@@ -42,15 +42,6 @@
 #define MAKE_DIRTY(mydata,ring)  /* DIRTY is not currently supported */
 #endif
 
-#ifdef HISTOGRAM
-#define HISTOGRAM_VARS        struct timeval time_one,time_two
-#define HIST_TIMESTAMP(time)  gettimeofday(time,NULL)
-#define HIST_ADD(h,delta)     HIST_add(h,delta)
-#else
-#define HISTOGRAM_VARS       /* variable declarations for histogram go here */
-#define HIST_TIMESTAMP(time) /* time stamp call for histogram goes here */
-#define HIST_ADD(h,delta)    /* call to add data to histogram goes here */
-#endif
 
 /****************************************************************/
 /*                                                              */
@@ -1312,7 +1303,7 @@
   }
   /* code to timestamp enabled by WANT_HISTOGRAM */
   HIST_TIMESTAMP(&time_two);
-  HIST_ADD(my_data->time_hist,delta_micro(&time_one,&time_two));
+  HIST_ADD(my_data->time_hist,&time_one,&time_two);
   new_state = CHECK_REQ_STATE;
   if (new_state == TEST_LOADED) {
     /* transitioning to loaded state from measure state
@@ -1497,7 +1488,7 @@
   my_data->send_ring = my_data->send_ring->next;
   /* code to timestamp enabled by WANT_HISTOGRAM */
   HIST_TIMESTAMP(&time_two);
-  HIST_ADD(my_data->time_hist,delta_micro(&time_one,&time_two));
+  HIST_ADD(my_data->time_hist,&time_one,&time_two);
   new_state = CHECK_REQ_STATE;
   if (new_state == TEST_LOADED) {
     /* transitioning to loaded state from measure state
@@ -1913,7 +1904,7 @@
   }
   /* code to timestamp enabled by WANT_HISTOGRAM */
   HIST_TIMESTAMP(&time_two);
-  HIST_ADD(my_data->time_hist,delta_micro(&time_one,&time_two));
+  HIST_ADD(my_data->time_hist,&time_one,&time_two);
   my_data->recv_ring = my_data->recv_ring->next;
   my_data->send_ring = my_data->send_ring->next;
   new_state = CHECK_REQ_STATE;
@@ -2164,7 +2155,7 @@
   }
   /* code to timestamp enabled by WANT_HISTOGRAM */
   HIST_TIMESTAMP(&time_two);
-  HIST_ADD(my_data->time_hist,delta_micro(&time_one,&time_two));
+  HIST_ADD(my_data->time_hist,&time_one,&time_two);
   my_data->stats.named.trans_sent++;
   my_data->recv_ring = my_data->recv_ring->next;
   my_data->send_ring = my_data->send_ring->next;

Modified: trunk/src/nettest_dns.c
===================================================================
--- trunk/src/nettest_dns.c	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/nettest_dns.c	2006-03-20 21:48:31 UTC (rev 88)
@@ -35,15 +35,6 @@
 #include "config.h"
 #endif
 
-#ifdef HISTOGRAM
-#define HISTOGRAM_VARS        struct timeval time_one,time_two
-#define HIST_TIMESTAMP(time)  gettimeofday(time,NULL)
-#define HIST_ADD(h,delta)     HIST_add(h,delta)
-#else
-#define HISTOGRAM_VARS       /* variable declarations for histogram go here */
-#define HIST_TIMESTAMP(time) /* time stamp call for histogram goes here */
-#define HIST_ADD(h,delta)    /* call to add data to histogram goes here */
-#endif
 
 /****************************************************************/
 /*                                                              */
@@ -1524,8 +1515,7 @@
 	/* this is what we want to see */
 	/* code to timestamp enabled by WANT_HISTOGRAM */
 	HIST_TIMESTAMP(&time_two);
-	HIST_ADD(my_data->time_hist,
-		 delta_milli(&(status_entry->sent_time),&time_two));
+	HIST_ADD(my_data->time_hist, &(status_entry->sent_time), &time_two);
 	/* my_data->stats.named.responses_received++; */
 	/* so we can continue to "leverage" the nettest_bsd reporter for
 	   now. raj 2005-11-18 */

Modified: trunk/src/nettest_vst.c
===================================================================
--- trunk/src/nettest_vst.c	2006-03-20 19:38:00 UTC (rev 87)
+++ trunk/src/nettest_vst.c	2006-03-20 21:48:31 UTC (rev 88)
@@ -18,16 +18,8 @@
 #define MAKE_DIRTY(mydata,ring)  /* DIRTY is not currently supported */
 #endif
 
-#ifdef WANT_HISTOGRAM
-#define HISTOGRAM_VARS        struct timeval time_one,time_two
-#define HIST_TIMESTAMP(time)  gettimeofday(time,NULL)
-#define HIST_ADD(h,delta)     HIST_add(h,delta)
-#else
-#define HISTOGRAM_VARS       /* variable declarations for histogram go here */
-#define HIST_TIMESTAMP(time) /* time stamp call for histogram goes here */
-#define HIST_ADD(h,delta)    /* call to add data to histogram goes here */
-#endif
 
+
 /****************************************************************/
 /*                                                              */
 /*      nettest_vst.c                                           */
@@ -1774,7 +1766,7 @@
     }
     /* code to timestamp enabled by WANT_HISTOGRAM */
     HIST_TIMESTAMP(&time_two);
-    HIST_ADD(my_data->time_hist,delta_macro(&time_one,&time_two));
+    HIST_ADD(my_data->time_hist,&time_one,&time_two);
     get_next_vst_transaction(test);
   }
   new_state = CHECK_REQ_STATE;
@@ -2073,7 +2065,7 @@
     }
     /* code to timestamp enabled by WANT_HISTOGRAM */
     HIST_TIMESTAMP(&time_two);
-    HIST_ADD(my_data->time_hist,delta_macro(&time_one,&time_two));
+    HIST_ADD(my_data->time_hist,&time_one,&time_two);
     my_data->stats.named.trans_sent++;
     get_next_vst_transaction(test);
     if (len == 0) {



More information about the netperf-dev mailing list