[netperf-dev] netperf4 commit notice r142 - branches/glib_migration/src

raj at netperf.org raj at netperf.org
Mon Apr 10 16:46:04 PDT 2006


Author: raj
Date: 2006-04-10 16:46:03 -0700 (Mon, 10 Apr 2006)
New Revision: 142

Modified:
   branches/glib_migration/src/netsysstats_aix.c
   branches/glib_migration/src/netsysstats_common.c
Log:
Fixes for AIX 5 CPU utilization, based on using the idle, sys and user fields
rather than the pidle, psys and puser fields of a perfstat_cpu_t which are
only there in 5.3 and later and I'm still not sure how to use them properly


Modified: branches/glib_migration/src/netsysstats_aix.c
===================================================================
--- branches/glib_migration/src/netsysstats_aix.c	2006-04-08 00:49:37 UTC (rev 141)
+++ branches/glib_migration/src/netsysstats_aix.c	2006-04-10 23:46:03 UTC (rev 142)
@@ -97,6 +97,11 @@
   return(err);
 }
 
+/* this file is the one we use if we aren't on AIX 5.3, which means we
+   need to limit ourselves to using the idle, sys and user fields and
+   cannot use the added-in-5.3 pidle, psys and puser fields.  those
+   are used in the netsysstats_aix53.c file */
+
 void
 get_cpu_time_counters(cpu_time_counters_t *res,
                       struct timeval *timestamp,
@@ -127,13 +132,13 @@
 
     for (i = 0; i < num_cpus; i++) {
       /* our "calibration" value will be our "elapsed" time multiplied
-	 by the processorHZ. */
+	 by the value of _SC_CLK_TCK. */
       res[i].calibrate = (uint64_t)(elapsed * 
-				    (double) psp->processorHZ);
-      res[i].idle      = per_cpu_data[i].pidle;
+				    (double) sysconf(_SC_CLK_TCK));
+      res[i].idle      = per_cpu_data[i].idle;
 #ifndef EXTRA_COUNTERS_MISSING
-      res[i].user      = per_cpu_data[i].puser;
-      res[i].kernel    = per_cpu_data[i].psys;
+      res[i].user      = per_cpu_data[i].user;
+      res[i].kernel    = per_cpu_data[i].sys;
       res[i].interrupt = 0;
 
       res[i].other     = res[i].calibrate;
@@ -144,6 +149,7 @@
 #endif
       
       if(test->debug) {
+	fprintf(test->where, "\tcalibrate[%d] = %"PRIx64, i, res[i].calibrate);
 	fprintf(test->where, "\tidle[%d] = %"PRIx64, i, res[i].idle);
 #ifndef EXTRA_COUNTERS_MISSING
 	fprintf(test->where, "\tuser[%d] = %"PRIx64, i, res[i].user);

Modified: branches/glib_migration/src/netsysstats_common.c
===================================================================
--- branches/glib_migration/src/netsysstats_common.c	2006-04-08 00:49:37 UTC (rev 141)
+++ branches/glib_migration/src/netsysstats_common.c	2006-04-10 23:46:03 UTC (rev 142)
@@ -171,6 +171,29 @@
 
     delta[i].other = delta[i].calibrate - subtotal;
 
+    if(test->debug) {
+      fprintf(test->where, 
+	      "%s delta calibrate[%d] = %"PRIx64,
+	      __func__, i, delta[i].calibrate);
+      fprintf(test->where, 
+	      "\n\tdelta idle[%d] = %"PRIx64,
+	      i, delta[i].idle);
+      fprintf(test->where,
+	      "\n\tdelta user[%d] = %"PRIx64,
+	      i, delta[i].user);
+      fprintf(test->where,
+	      "\n\tdelta kern[%d] = %"PRIx64,
+	      i, delta[i].kernel);
+      fprintf(test->where,
+	      "\n\tdelta intr[%d] = %"PRIx64,
+	      i, delta[i].interrupt);
+      fprintf(test->where,
+	      "\n\tdelta othr[%d] = %"PRIx64,
+	      i, delta[i].other);
+      fprintf(test->where, "\n");
+      fflush(test->where);
+    }
+
     if (subtotal > delta[i].calibrate) {
       /* hmm, what is the right thing to do here? for now simply
 	 zero-out other. in the future consider emitting a
@@ -195,6 +218,7 @@
     sys_total->interrupt += delta[i].interrupt;
     sys_total->other     += delta[i].other;
   }
+  NETPERF_DEBUG_EXIT(test->debug,test->where);
 }
   
 static void
@@ -582,12 +606,14 @@
 	
 	if (CHECK_REQ_STATE == TEST_MEASURE) {
 	  g_usleep(1000000);
-	} else if (CHECK_REQ_STATE == TEST_LOADED) {
+	} 
+	else if (CHECK_REQ_STATE == TEST_LOADED) {
 	  /* get_cpu_time_counters sets current timestamp */
 	  get_cpu_time_counters(tsd->ending_cpu_counters,&(tsd->curr_time),test);
 	  update_sys_stats(test);
 	  SET_TEST_STATE(TEST_LOADED);
-	} else {
+	} 
+	else {
 	  report_test_failure(test,
 			      "sys_stats",
 			      SYS_STATS_REQUESTED_STATE_INVALID,



More information about the netperf-dev mailing list