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

raj at netperf.org raj at netperf.org
Tue Jan 31 18:14:49 PST 2012


Author: raj
Date: 2012-01-31 18:14:49 -0800 (Tue, 31 Jan 2012)
New Revision: 527

Modified:
   trunk/src/netcpu_kstat.c
   trunk/src/netcpu_looper.c
   trunk/src/netcpu_none.c
   trunk/src/netcpu_ntperf.c
   trunk/src/netcpu_osx.c
   trunk/src/netcpu_perfstat.c
   trunk/src/netcpu_pstat.c
   trunk/src/netcpu_pstatnew.c
   trunk/src/netcpu_sysctl.c
Log:
more of the trailing whitespace kick

Modified: trunk/src/netcpu_kstat.c
===================================================================
--- trunk/src/netcpu_kstat.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_kstat.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -48,7 +48,7 @@
                                      need to pull the cpu info from
                                      the kstat interface.  at least I
                                      think that is what this is :) raj
-                                     8/2000 */  
+                                     8/2000 */
 
 #define UPDKCID(nk,ok) \
 if (nk == -1) { \
@@ -80,11 +80,11 @@
     fprintf(where,"open_kstat: enter\n");
     fflush(where);
   }
-  
+
   /*
    * 0. kstat_open
    */
-  
+
   if (!kc)
     {
       kc = kstat_open();
@@ -111,7 +111,7 @@
     fprintf(where,"passing kcid_changed\n");
     fflush(where);
   }
-  
+
   /*
    * 1.  kstat_chain_update
    */
@@ -128,28 +128,28 @@
     fprintf(where,"kstat_lookup for unix/system_misc\n");
     fflush(where);
   }
-  
+
   ks = kstat_lookup(kc, "unix", 0, "system_misc");
   if (kstat_read(kc, ks, 0) == -1) {
     perror("kstat_read");
     exit(1);
   }
-  
-  
+
+
   if (changed) {
-    
+
     /*
      * 2. get data addresses
      */
-    
+
     ncpu = 0;
-    
+
     kn = kstat_data_lookup(ks, "ncpus");
     if (kn && kn->value.ui32 > lib_num_loc_cpus) {
       fprintf(stderr,"number of CPU's mismatch!");
       exit(1);
     }
-    
+
     for (ks = kc->kc_chain; ks;
          ks = ks->ks_next)
       {
@@ -162,7 +162,7 @@
                values. hopefully this is not going to be a big
                issue. raj 8/2000 */
             UPDKCID(nkcid, kcid);
-            
+
             if (debug) {
               fprintf(where,"cpu_ks[%d] getting %p\n",ncpu,ks);
               fflush(where);
@@ -173,7 +173,7 @@
             if (ncpu > lib_num_loc_cpus)
               {
                 /* with the check above, would we ever hit this? */
-                fprintf(stderr, 
+                fprintf(stderr,
                         "kstat finds too many cpus %d: should be %d\n",
                         ncpu,lib_num_loc_cpus);
                 exit(1);
@@ -212,7 +212,7 @@
 }
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   open_kstat();
   return;
@@ -248,28 +248,28 @@
 float
 calibrate_idle_rate(int iterations, int interval)
 {
- 
-  long  
+
+  long
     firstcnt[MAXCPUS],
     secondcnt[MAXCPUS];
 
-  float 
+  float
     elapsed,
     temp_rate,
     rate[MAXTIMES],
     local_maxrate;
 
-  long  
+  long
     sec,
     usec;
 
-  int   
+  int
     i,
     j;
-  
+
   struct  timeval time1, time2 ;
   struct  timezone tz;
-  
+
   if (debug) {
     fprintf(where,"calling open_kstat from calibrate_kstat\n");
     fflush(where);
@@ -282,7 +282,7 @@
   }
 
   local_maxrate = (float)-1.0;
-  
+
   for(i = 0; i < iterations; i++) {
     rate[i] = (float)0.0;
     for (j = 0; j < lib_num_loc_cpus; j++) {
@@ -300,7 +300,7 @@
     sec = time2.tv_sec - time1.tv_sec;
     usec = time2.tv_usec - time1.tv_usec;
     elapsed = (float)sec + ((float)usec/(float)1000000.0);
-    
+
     if(debug) {
       fprintf(where, "Calibration for kstat counter run: %d\n",i);
       fprintf(where,"\tsec = %ld usec = %ld\n",sec,usec);
@@ -324,7 +324,7 @@
       /* we assume that it would wrap no more than once. we also */
       /* assume that the result of subtracting will "fit" raj 4/95 */
       temp_rate = (secondcnt[j] >= firstcnt[j]) ?
-        (float)(secondcnt[j] - firstcnt[j])/elapsed : 
+        (float)(secondcnt[j] - firstcnt[j])/elapsed :
           (float)(secondcnt[j]-firstcnt[j]+MAXLONG)/elapsed;
       if (temp_rate > rate[i]) rate[i] = temp_rate;
       if(debug) {
@@ -354,9 +354,9 @@
   /* calculations - for example, tests that were ended by */
   /* watchdog timers such as the udp stream test. We let these */
   /* tests tell up what the elapsed time should be. */
-  
+
   if (elapsed_time != 0.0) {
-    correction_factor = (float) 1.0 + 
+    correction_factor = (float) 1.0 +
       ((lib_elapsed - elapsed_time) / elapsed_time);
   }
   else {
@@ -370,12 +370,12 @@
      tracks. if this happens, we need to ensure that the calculation
      does not go south. raj 6/95 and if we run completely out of idle,
      the same thing could in theory happen to the USE_KSTAT path. raj
-     8/2000 */ 
-    
+     8/2000 */
+
     if (lib_end_count[i] == lib_start_count[i]) {
       lib_end_count[i]++;
     }
-    
+
     actual_rate = (lib_end_count[i] > lib_start_count[i]) ?
       (float)(lib_end_count[i] - lib_start_count[i])/lib_elapsed :
       (float)(lib_end_count[i] - lib_start_count[i] +
@@ -395,7 +395,7 @@
   }
   /* we want the average across all n processors */
   lib_local_cpu_util /= (float)lib_num_loc_cpus;
-  
+
   return lib_local_cpu_util;
 }
 

Modified: trunk/src/netcpu_looper.c
===================================================================
--- trunk/src/netcpu_looper.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_looper.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -2,7 +2,7 @@
 @(#)netcpu_looper.c (c) Copyright 2005-2007. Version 2.4.3";
 
 /* netcpu_looper.c
-  
+
    Implement the soaker process specific portions of netperf CPU
    utilization measurements. These are broken-out into a separate file
    to make life much nicer over in netlib.c which had become a maze of
@@ -135,7 +135,7 @@
 
   if (processor_bind(P_PID,
                      getpid(),
-                     (child_num % lib_num_loc_cpus), 
+                     (child_num % lib_num_loc_cpus),
                       &old_binding) != 0) {
     fprintf(where,"bind_to_processor: unable to perform processor binding\n");
     fprintf(where,"                   errno %d\n",errno);
@@ -171,7 +171,7 @@
  /* by each looper process, or something appropriate on Windows/NT */
  /* (malloc'd or such). This routine is reasonably ugly in that it has */
  /* priority manipulating code for lots of different operating */
- /* systems. This routine never returns. raj 1/96 */ 
+ /* systems. This routine never returns. raj 1/96 */
 
 static void
 sit_and_spin(int child_index)
@@ -191,14 +191,14 @@
             getpid());
     fflush(where);
   }
-  
+
 #endif /* WIN32 */
 
   /* reset our base pointer to be at the appropriate offset */
-  my_counter_ptr = (uint64_t *) ((char *)lib_base_pointer + 
-                             (netlib_get_page_size() * 
+  my_counter_ptr = (uint64_t *) ((char *)lib_base_pointer +
+                             (netlib_get_page_size() *
                               PAGES_PER_CHILD * child_index));
-  
+
   /* in the event we are running on an MP system, it would */
   /* probably be good to bind the soaker processes to specific */
   /* processors. I *think* this is the most reasonable thing to */
@@ -207,13 +207,13 @@
   /* here, but will "abstract it into another routine to keep this */
   /* area more readable. I'll probably do the same thine with the */
   /* "low pri code" raj 10/95 */
-  
+
   /* since we are "flying blind" wrt where we should bind the looper
      processes, we want to use the cpu_map that was prepared by netlib
      rather than assume that the CPU ids on the system start at zero
      and are contiguous. raj 2006-04-03 */
   bind_to_specific_processor(child_index % lib_num_loc_cpus,1);
-  
+
   for (*my_counter_ptr = 0L;
        ;
        (*my_counter_ptr)++) {
@@ -230,7 +230,7 @@
       pid = getpid();
       /* if you are not root, this call will return EPERM - why one */
       /* cannot change one's own priority to  lower value is beyond */
-      /* me. raj 2/26/96 */  
+      /* me. raj 2/26/96 */
       setpri(pid, prio);
 #else /* _AIX */
 #ifdef __sgi
@@ -276,16 +276,16 @@
 {
 
   unsigned int      i, file_size;
-  
+
   /* we want at least two pages for each processor. the */
   /* child for any one processor will write to the first of his two */
   /* pages, and the second page will be a buffer in case there is page */
   /* prefetching. if your system pre-fetches more than a single page, */
   /* well, you'll have to modify this or live with it :( raj 4/95 */
 
-  file_size = ((netlib_get_page_size() * PAGES_PER_CHILD) * 
+  file_size = ((netlib_get_page_size() * PAGES_PER_CHILD) *
                lib_num_loc_cpus);
-  
+
 #ifndef WIN32
 
   /* we we are not using WINDOWS NT (or 95 actually :), then we want */
@@ -297,30 +297,30 @@
   /* debugging, could result in some filesystem activity - like */
   /* metadata updates? raj 4/96 */
   lib_idle_fd = open("/tmp/netperf_cpu",O_RDWR | O_CREAT | O_EXCL);
-  
+
   if (lib_idle_fd == -1) {
     fprintf(where,"create_looper: file creation; errno %d\n",errno);
     fflush(where);
     exit(1);
   }
-  
+
   if (chmod("/tmp/netperf_cpu",0644) == -1) {
     fprintf(where,"create_looper: chmod; errno %d\n",errno);
     fflush(where);
     exit(1);
   }
-  
+
   /* with the file descriptor in place, lets be sure that the file is */
   /* large enough. */
-  
+
   if (truncate("/tmp/netperf_cpu",file_size) == -1) {
     fprintf(where,"create_looper: truncate: errno %d\n",errno);
     fflush(where);
     exit(1);
   }
-  
+
   /* the file should be large enough now, so we can mmap it */
-  
+
   /* if the system does not have MAP_VARIABLE, just define it to */
   /* be zero. it is only used/needed on HP-UX (?) raj 4/95 */
 #ifndef MAP_VARIABLE
@@ -339,8 +339,8 @@
     fflush(where);
     exit(1);
   }
-  
 
+
   if (debug > 1) {
     fprintf(where,"num CPUs %d, file_size %d, lib_base_pointer %p\n",
             lib_num_loc_cpus,
@@ -350,7 +350,7 @@
   }
 
   /* we should have a valid base pointer. lets fork */
-  
+
   for (i = 0; i < (unsigned int)lib_num_loc_cpus; i++) {
     switch (lib_idle_pids[i] = fork()) {
     case -1:
@@ -368,8 +368,8 @@
       break;
     default:
       /* we must be the parent */
-      lib_idle_address[i] = (uint64_t *) ((char *)lib_base_pointer + 
-                                      (netlib_get_page_size() * 
+      lib_idle_address[i] = (uint64_t *) ((char *)lib_base_pointer +
+                                      (netlib_get_page_size() *
                                        PAGES_PER_CHILD * i));
       if (debug) {
         fprintf(where,"lib_idle_address[%d] is %p\n",
@@ -404,8 +404,8 @@
       /* I wonder if I need to look for other threads to kill? */
       exit(1);
     }
-    lib_idle_address[i] = (long *) ((char *)lib_base_pointer + 
-                                    (netlib_get_page_size() * 
+    lib_idle_address[i] = (long *) ((char *)lib_base_pointer +
+                                    (netlib_get_page_size() *
                                      PAGES_PER_CHILD * i));
     if (debug) {
       fprintf(where,"lib_idle_address[%d] is %p\n",
@@ -423,7 +423,7 @@
 }
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   cpu_method = LOOPER;
 
@@ -458,10 +458,10 @@
   lib_loopers_running = 0;
   /* reap the children */
   while(waitpid(-1, NULL, WNOHANG) > 0) { }
-  
+
   /* finally, unlink the mmaped file */
   munmap((caddr_t)lib_base_pointer,
-         ((netlib_get_page_size() * PAGES_PER_CHILD) * 
+         ((netlib_get_page_size() * PAGES_PER_CHILD) *
           lib_num_loc_cpus));
   unlink("/tmp/netperf_cpu");
 #endif
@@ -488,29 +488,29 @@
     firstcnt[MAXCPUS],
     secondcnt[MAXCPUS];
 
-  float 
+  float
     elapsed,
     temp_rate,
     rate[MAXTIMES],
     local_maxrate;
 
-  long  
+  long
     sec,
     usec;
 
-  int   
+  int
     i,
     j;
-  
+
   struct  timeval time1, time2 ;
   struct  timezone tz;
-  
+
   if (iterations > MAXTIMES) {
     iterations = MAXTIMES;
   }
 
   local_maxrate = (float)-1.0;
-  
+
   for(i = 0; i < iterations; i++) {
     rate[i] = (float)0.0;
     for (j = 0; j < lib_num_loc_cpus; j++) {
@@ -528,7 +528,7 @@
     sec = time2.tv_sec - time1.tv_sec;
     usec = time2.tv_usec - time1.tv_usec;
     elapsed = (float)sec + ((float)usec/(float)1000000.0);
-    
+
     if(debug) {
       fprintf(where, "Calibration for counter run: %d\n",i);
       fprintf(where,"\tsec = %ld usec = %ld\n",sec,usec);
@@ -552,7 +552,7 @@
       /* we assume that it would wrap no more than once. we also */
       /* assume that the result of subtracting will "fit" raj 4/95 */
       temp_rate = (secondcnt[j] >= firstcnt[j]) ?
-        (float)(secondcnt[j] - firstcnt[j])/elapsed : 
+        (float)(secondcnt[j] - firstcnt[j])/elapsed :
           (float)(secondcnt[j]-firstcnt[j]+MAXLONG)/elapsed;
       if (temp_rate > rate[i]) rate[i] = temp_rate;
       if(debug) {
@@ -594,9 +594,9 @@
   /* calculations - for example, tests that were ended by */
   /* watchdog timers such as the udp stream test. We let these */
   /* tests tell up what the elapsed time should be. */
-  
+
   if (elapsed_time != 0.0) {
-    correction_factor = (float) 1.0 + 
+    correction_factor = (float) 1.0 +
       ((lib_elapsed - elapsed_time) / elapsed_time);
   }
   else {
@@ -610,12 +610,12 @@
      tracks. if this happens, we need to ensure that the calculation
      does not go south. raj 6/95 and if we run completely out of idle,
      the same thing could in theory happen to the USE_KSTAT path. raj
-     8/2000 */ 
-    
+     8/2000 */
+
     if (lib_end_count[i] == lib_start_count[i]) {
       lib_end_count[i]++;
     }
-    
+
     actual_rate = (lib_end_count[i] > lib_start_count[i]) ?
       (float)(lib_end_count[i] - lib_start_count[i])/lib_elapsed :
       (float)(lib_end_count[i] - lib_start_count[i] +
@@ -637,7 +637,7 @@
   }
   /* we want the average across all n processors */
   lib_local_cpu_util /= (float)lib_num_loc_cpus;
-  
+
   return lib_local_cpu_util;
 }
 

Modified: trunk/src/netcpu_none.c
===================================================================
--- trunk/src/netcpu_none.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_none.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -19,7 +19,7 @@
 #include "netlib.h"
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   return;
 }

Modified: trunk/src/netcpu_ntperf.c
===================================================================
--- trunk/src/netcpu_ntperf.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_ntperf.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -27,14 +27,14 @@
 // System CPU time information class.
 // Used to get CPU time information.
 //
-//     SDK\inc\ntexapi.h 
+//     SDK\inc\ntexapi.h
 // Function x8:   SystemProcessorPerformanceInformation
-// DataStructure: SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION 
+// DataStructure: SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
 //
 
 #define SystemProcessorPerformanceInformation 0x08
 
-typedef struct 
+typedef struct
 {
         LARGE_INTEGER   IdleTime;
         LARGE_INTEGER   KernelTime;
@@ -47,11 +47,11 @@
 //
 // Calls to get the information
 //
-typedef ULONG (__stdcall *NT_QUERY_SYSTEM_INFORMATION)( 
-                                                                                        ULONG SystemInformationClass, 
-                                                                                        PVOID SystemInformation, 
+typedef ULONG (__stdcall *NT_QUERY_SYSTEM_INFORMATION)(
+                                                                                        ULONG SystemInformationClass,
+                                                                                        PVOID SystemInformation,
                                                                                         ULONG SystemInformationLength,
-                                                                                        PULONG ReturnLength 
+                                                                                        PULONG ReturnLength
                                                                                         );
 
 NT_QUERY_SYSTEM_INFORMATION NtQuerySystemInformation = NULL;
@@ -72,7 +72,7 @@
    call.  References to the PDH.DLL have been deleted.  This structure
    is the root for these data structures. */
 
-typedef struct sPerfObj 
+typedef struct sPerfObj
 {
         LARGE_INTEGER   StartTime;
         LARGE_INTEGER   EndTime;
@@ -91,7 +91,7 @@
 
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   if (NtQuerySystemInformation == NULL) {
     // Open the performance counter interface
@@ -129,7 +129,7 @@
 
 
 /*
-  InitPerfCntrs() - 
+  InitPerfCntrs() -
 
   Changed to no longer access the NT performance registry interfaces.
   A direct call to NtQuerySystemInformation (an undocumented NT API)
@@ -149,20 +149,20 @@
 
   NewPerfCntrs = (PerfObj *)GlobalAlloc(GPTR, sizeof(PerfObj));
   assert(NewPerfCntrs != NULL);
-  
+
   ZeroMemory((PCHAR)NewPerfCntrs, sizeof(PerfObj));
-  
+
   // get NT version
   NTVersion = GetVersion();
-  if (NTVersion >= 0x80000000) 
+  if (NTVersion >= 0x80000000)
     {
       fprintf(stderr, "Not running on Windows NT\n");
       exit(1);
     }
-  
+
   // locate the calls we need in NTDLL
-  //Lint 
-  NtQuerySystemInformation = 
+  //Lint
+  NtQuerySystemInformation =
     (NT_QUERY_SYSTEM_INFORMATION)GetProcAddress( GetModuleHandle("ntdll.dll"),
 						 "NtQuerySystemInformation" );
 
@@ -173,16 +173,16 @@
       fprintf(stderr, "GetProcAddressFailed, status: %lX\n", status);
       exit(1);
     }
-  
+
   // setup to measure timestamps with the high resolution timers.
   if (QueryPerformanceFrequency(&TickHz) == FALSE)
     {
       fprintf(stderr,"MAIN - QueryPerformanceFrequency Failed!\n");
-      exit(2);   
+      exit(2);
     }
-  
+
   RestartPerfCntrs(NewPerfCntrs);
-  
+
   return(NewPerfCntrs);
 }  /* InitPerfCntrs */
 
@@ -202,30 +202,30 @@
   DWORD returnLength = 0;  //Lint
   DWORD returnNumCPUs;  //Lint
   DWORD i;
-  
+
   DWORD status;
   SYSTEM_INFO SystemInfo;
 
   GetSystemInfo(&SystemInfo);
-  
+
   // Move previous data from EndInfo to StartInfo.
   CopyMemory((PCHAR)&PerfCntrs->StartInfo[0],
 	     (PCHAR)&PerfCntrs->EndInfo[0],
 	     sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*(MAXCPUS +1));
-  
+
   PerfCntrs->StartTime = PerfCntrs->EndTime;
-  
+
   // get the current CPUTIME information
   if ( (status = NtQuerySystemInformation( SystemProcessorPerformanceInformation,
 					   (PCHAR)&PerfCntrs->EndInfo[0], sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*MAXCPUS,
-					   &returnLength )) != 0) 
+					   &returnLength )) != 0)
     {
       fprintf(stderr, "NtQuery failed, status: %lX\n", status);
       exit(1);
     }
-  
+
   PerfCntrs->EndTime = ReadPerformanceCounter();
-  
+
   // Validate that NtQuery returned a reasonable amount of data
   if ((returnLength % sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)) != 0)
     {
@@ -234,8 +234,8 @@
 	      sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), returnLength);
       exit(1);
     }
-  returnNumCPUs = returnLength / sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION); 
-  
+  returnNumCPUs = returnLength / sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
+
   if (returnNumCPUs != (int)SystemInfo.dwNumberOfProcessors)
     {
       fprintf(stderr, "NtQuery didn't return expected amount of data\n");
@@ -243,17 +243,17 @@
 	      (int)SystemInfo.dwNumberOfProcessors, returnNumCPUs);
       exit(1);
     }
-  
+
   // Zero entries not returned by NtQuery
   ZeroMemory((PCHAR)&PerfCntrs->EndInfo[returnNumCPUs],
 	     sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*
 	     (MAXCPUS +1 - returnNumCPUs));
-  
+
   // Total all of the CPUs
   //      KernelTime needs to be fixed-up; it includes both idle &
-  // true kernel time 
+  // true kernel time
   //  Note that kernel time also includes DpcTime & InterruptTime, but
-  // I like this. 
+  // I like this.
   for (i=0; i < returnNumCPUs; i++)
     {
       PerfCntrs->EndInfo[i].KernelTime.QuadPart         -= PerfCntrs->EndInfo[i].IdleTime.QuadPart;
@@ -264,13 +264,13 @@
       PerfCntrs->EndInfo[MAXCPUS].InterruptTime.QuadPart += PerfCntrs->EndInfo[i].InterruptTime.QuadPart;
       PerfCntrs->EndInfo[MAXCPUS].InterruptCount                += PerfCntrs->EndInfo[i].InterruptCount;
     }
-  
+
 }   /* RestartPerfCntrs */
 
 /*
   ReportPerfCntrs() -
   This routine reports the results of the various performance
-  counters. 
+  counters.
 */
 
 double ReportPerfCntrs(PerfObj *PerfCntrs)
@@ -278,13 +278,13 @@
   double tot_CPU_Util;
   int i;
   double duration;  // in milliseconds
-  
+
   LARGE_INTEGER ActualDuration;
-  
-  SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION        DeltaInfo[MAXCPUS +1];  
-  
-  LARGE_INTEGER   TotalCPUTime[MAXCPUS +1];         
-  
+
+  SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION        DeltaInfo[MAXCPUS +1];
+
+  LARGE_INTEGER   TotalCPUTime[MAXCPUS +1];
+
   SYSTEM_INFO SystemInfo;
 
   GetSystemInfo(&SystemInfo);
@@ -303,8 +303,8 @@
 	PerfCntrs->StartInfo[i].InterruptTime.QuadPart;
       DeltaInfo[i].InterruptCount               = PerfCntrs->EndInfo[i].InterruptCount -
 	PerfCntrs->StartInfo[i].InterruptCount;
-      
-      TotalCPUTime[i].QuadPart =      
+
+      TotalCPUTime[i].QuadPart =
 	DeltaInfo[i].IdleTime.QuadPart +
 	DeltaInfo[i].KernelTime.QuadPart +
 	DeltaInfo[i].UserTime.QuadPart;
@@ -312,22 +312,22 @@
       // + DeltaInfo[i].DpcTime.QuadPart  +
       //  DeltaInfo[i].InterruptTime.QuadPart;
     }
-  
+
   tot_CPU_Util = 100.0*(1.0 - (double)DeltaInfo[MAXCPUS].IdleTime.QuadPart/(double)TotalCPUTime[MAXCPUS].QuadPart);  //Lint
-  
+
   // Re-calculate duration, since we may have stoped early due to cntr-C.
-  ActualDuration.QuadPart = PerfCntrs->EndTime.QuadPart - 
+  ActualDuration.QuadPart = PerfCntrs->EndTime.QuadPart -
     PerfCntrs->StartTime.QuadPart;
-  
+
   // convert to 100 usec (1/10th milliseconds) timebase.
   ActualDuration.QuadPart = (ActualDuration.QuadPart*10000)/TickHz.QuadPart;
   duration = (double)ActualDuration.QuadPart/10.0;  // duration in ms
-  
+
   if (verbosity > 1)
     {
       fprintf(where,"ActualDuration (ms): %d\n", (int)duration);
     }
-  
+
   if (verbosity > 1)
     {
       fprintf(where, "%% CPU    _Total");
@@ -339,91 +339,91 @@
 	    }
 	}
       fprintf(where, "\n");
-      
+
       fprintf(where, "Busy      %5.2f", tot_CPU_Util);
       if ((int)SystemInfo.dwNumberOfProcessors > 1)
 	{
 	  for (i=0; i < (int)SystemInfo.dwNumberOfProcessors; i++)
 	    {
-	      fprintf(where, "\t %5.2f", 
+	      fprintf(where, "\t %5.2f",
 		      100.0*(1.0 - (double)DeltaInfo[i].IdleTime.QuadPart/(double)TotalCPUTime[i].QuadPart));  //Lint
 	    }
 	}
       fprintf(where, "\n");
-      
-      fprintf(where, "Kernel    %5.2f", 
+
+      fprintf(where, "Kernel    %5.2f",
 	      100.0*(double)DeltaInfo[MAXCPUS].KernelTime.QuadPart/(double)TotalCPUTime[MAXCPUS].QuadPart);  //Lint
-      
+
       if ((int)SystemInfo.dwNumberOfProcessors > 1)
 	{
 	  for (i=0; i < (int)SystemInfo.dwNumberOfProcessors; i++)
 	    {
-	      fprintf(where, "\t %5.2f", 
+	      fprintf(where, "\t %5.2f",
 		      100.0*(double)DeltaInfo[i].KernelTime.QuadPart/(double)TotalCPUTime[i].QuadPart);  //Lint
 	    }
 	}
       fprintf(where, "\n");
-      
-      fprintf(where, "User      %5.2f", 
+
+      fprintf(where, "User      %5.2f",
 	      100.0*(double)DeltaInfo[MAXCPUS].UserTime.QuadPart/(double)TotalCPUTime[MAXCPUS].QuadPart);
-      
+
       if ((int)SystemInfo.dwNumberOfProcessors > 1)
 	{
 	  for (i=0; i < (int)SystemInfo.dwNumberOfProcessors; i++)
 	    {
-	      fprintf(where, "\t %5.2f", 
+	      fprintf(where, "\t %5.2f",
 		      100.0*(double)DeltaInfo[i].UserTime.QuadPart/TotalCPUTime[i].QuadPart);  //Lint
 	    }
 	}
       fprintf(where, "\n");
-      
-      fprintf(where, "Dpc       %5.2f", 
+
+      fprintf(where, "Dpc       %5.2f",
 	      100.0*(double)DeltaInfo[MAXCPUS].DpcTime.QuadPart/(double)TotalCPUTime[MAXCPUS].QuadPart);  //Lint
-      
+
       if ((int)SystemInfo.dwNumberOfProcessors > 1)
 	{
 	  for (i=0; i < (int)SystemInfo.dwNumberOfProcessors; i++)
 	    {
-	      fprintf(where, "\t %5.2f", 
+	      fprintf(where, "\t %5.2f",
 		      100.0*(double)DeltaInfo[i].DpcTime.QuadPart/(double)TotalCPUTime[i].QuadPart);  //Lint
 	    }
 	}
       fprintf(where, "\n");
-      
-      fprintf(where, "Interrupt %5.2f", 
+
+      fprintf(where, "Interrupt %5.2f",
 	      100.0*(double)DeltaInfo[MAXCPUS].InterruptTime.QuadPart/(double)TotalCPUTime[MAXCPUS].QuadPart);  //Lint
-      
+
       if ((int)SystemInfo.dwNumberOfProcessors > 1)
 	{
 	  for (i=0; i < (int)SystemInfo.dwNumberOfProcessors; i++)
 	    {
-	      fprintf(where, "\t %5.2f", 
+	      fprintf(where, "\t %5.2f",
 		      100.0*(double)DeltaInfo[i].InterruptTime.QuadPart/TotalCPUTime[i].QuadPart);  //Lint
 	    }
 	}
       fprintf(where, "\n\n");
-      
-      fprintf(where, "Interrupt/Sec. %5.1f", 
+
+      fprintf(where, "Interrupt/Sec. %5.1f",
 	      (double)DeltaInfo[MAXCPUS].InterruptCount*1000.0/duration);
-      
+
       if ((int)SystemInfo.dwNumberOfProcessors > 1)
 	{
 	  for (i=0; i < (int)SystemInfo.dwNumberOfProcessors; i++)
 	    {
-	      fprintf(where, "\t %5.1f", 
+	      fprintf(where, "\t %5.1f",
 		      (double)DeltaInfo[i].InterruptCount*1000.0/duration);
 	    }
 	}
       fprintf(where, "\n\n");
       fflush(where);
     }
-  
+
   return (tot_CPU_Util);
-  
+
 }  /* ReportPerfCntrs */
 
 /*
-  ClosePerfCntrs() -  
+  ClosePerfCntrs() -
 
   This routine cleans up the performance counter APIs.
 */
@@ -448,7 +448,7 @@
 }
 
 float
-calc_cpu_util_internal(float elapsed_time) 
+calc_cpu_util_internal(float elapsed_time)
 {
   float correction_factor;
   lib_local_cpu_util = (float)0.0;
@@ -457,9 +457,9 @@
   /* calculations - for example, tests that were ended by */
   /* watchdog timers such as the udp stream test. We let these */
   /* tests tell up what the elapsed time should be. */
-  
+
   if (elapsed_time != 0.0) {
-    correction_factor = (float) 1.0 + 
+    correction_factor = (float) 1.0 +
       ((lib_elapsed - elapsed_time) / elapsed_time);
   }
   else {

Modified: trunk/src/netcpu_osx.c
===================================================================
--- trunk/src/netcpu_osx.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_osx.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -61,7 +61,7 @@
 static mach_port_t lib_host_port;
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   lib_host_port = mach_host_self();
   return;
@@ -102,7 +102,7 @@
 float
 calibrate_idle_rate(int iterations, int interval)
 {
-    return (float)0.0;   
+    return (float)0.0;
 }
 
 float
@@ -117,9 +117,9 @@
      example, tests that were ended by watchdog timers such as the udp
      stream test. We let these tests tell up what the elapsed time
      should be. */
-  
+
   if (elapsed_time != 0.0) {
-    correction_factor = (float) 1.0 + 
+    correction_factor = (float) 1.0 +
       ((lib_elapsed - elapsed_time) / elapsed_time);
   }
   else {

Modified: trunk/src/netcpu_perfstat.c
===================================================================
--- trunk/src/netcpu_perfstat.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_perfstat.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -31,7 +31,7 @@
 # ifndef LONG_LONG_MAX
 #  define LONG_LONG_MAX LLONG_MAX
 # endif /* LONG_LONG_MAX */
-#endif 
+#endif
 
 #include <errno.h>
 
@@ -48,7 +48,7 @@
 
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   return;
 }
@@ -72,7 +72,7 @@
   perfstat_cpu_t *per_cpu_pointer;
   perfstat_id_t  name;
   int i,ret;
-  
+
   /* a name of "" will cause us to start from the beginning */
   strcpy(name.name,"");
   perfstat_buffer = (perfstat_cpu_t *)malloc(lib_num_loc_cpus *
@@ -84,14 +84,14 @@
     fflush(where);
     exit(-1);
   }
-  
+
   /* happiness and joy, keep going */
   ret = perfstat_cpu(&name,
 		     perfstat_buffer,
 		     sizeof(perfstat_cpu_t),
 		     lib_num_loc_cpus);
-  
-  if ((ret == -1) || 
+
+  if ((ret == -1) ||
       (ret != lib_num_loc_cpus)) {
     fprintf(where,
 	    "cpu_start: perfstat_cpu failed/count off; errno %d cpus %d count %d\n",
@@ -101,14 +101,14 @@
     fflush(where);
     exit(-1);
   }
-  
+
   per_cpu_pointer = perfstat_buffer;
   for (i = 0; i < lib_num_loc_cpus; i++){
     res[i] = per_cpu_pointer->idle;
     per_cpu_pointer++;
   }
   free(perfstat_buffer);
-  
+
   return;
 }
 
@@ -119,20 +119,20 @@
     firstcnt[MAXCPUS],
     secondcnt[MAXCPUS];
 
-  float 
+  float
     elapsed,
     temp_rate,
     rate[MAXTIMES],
     local_maxrate;
 
-  long  
+  long
     sec,
     usec;
 
-  int   
+  int
     i,
     j;
-  
+
   struct  timeval time1, time2 ;
   struct  timezone tz;
 
@@ -140,7 +140,7 @@
   perfstat_cpu_t  *per_cpu_pointer;
   perfstat_id_t   name;
   int ret;
-  
+
   if (debug) {
     fprintf(where,"enter calibrate_perfstat\n");
     fflush(where);
@@ -151,7 +151,7 @@
   }
 
   local_maxrate = (float)-1.0;
-  
+
   perfstat_buffer = (perfstat_cpu_t *)malloc(lib_num_loc_cpus *
                                              sizeof(perfstat_cpu_t));
   if (perfstat_buffer == NULL) {
@@ -166,14 +166,14 @@
     rate[i] = (float)0.0;
     /* a name of "" will cause us to start from the beginning */
     strcpy(name.name,"");
-     
+
     /* happiness and joy, keep going */
     ret = perfstat_cpu(&name,
                        perfstat_buffer,
                        sizeof(perfstat_cpu_t),
                        lib_num_loc_cpus);
-    
-    if ((ret == -1) || 
+
+    if ((ret == -1) ||
         (ret != lib_num_loc_cpus)) {
       fprintf(where,
               "calibrate_perfstat: perfstat_cpu failed/count off; errno %d cpus %d count %d\n",
@@ -207,8 +207,8 @@
                        perfstat_buffer,
                        sizeof(perfstat_cpu_t),
                        lib_num_loc_cpus);
-    
-    if ((ret == -1) || 
+
+    if ((ret == -1) ||
         (ret != lib_num_loc_cpus)) {
       fprintf(where,
               "calibrate_perfstat: perfstat_cpu failed/count off; errno %d cpus %d count %d\n",
@@ -220,7 +220,7 @@
     }
 
     per_cpu_pointer = perfstat_buffer;
-    
+
     if(debug) {
       fprintf(where,
 	      "Calibration for perfstat counter run: %d\n"
@@ -249,7 +249,7 @@
       /* we assume that it would wrap no more than once. we also
 	 assume that the result of subtracting will "fit" raj 4/95 */
       temp_rate = (secondcnt[j] >= firstcnt[j]) ?
-        (float)(secondcnt[j] - firstcnt[j])/elapsed : 
+        (float)(secondcnt[j] - firstcnt[j])/elapsed :
           (float)(secondcnt[j]-firstcnt[j]+MAXLONG)/elapsed;
       if (temp_rate > rate[i]) rate[i] = temp_rate;
       if(debug) {
@@ -323,7 +323,7 @@
 
   /* we want the average across all n processors */
   lib_local_cpu_util /= (float)lib_num_loc_cpus;
-  
+
   if (debug) {
     fprintf(where,
             "calc_cpu_util: average across CPUs is %g\n",lib_local_cpu_util);
@@ -345,7 +345,7 @@
   get_cpu_idle(lib_start_count);
   return;
 }
- 
+
 void
 cpu_stop_internal(void)
 {

Modified: trunk/src/netcpu_pstat.c
===================================================================
--- trunk/src/netcpu_pstat.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_pstat.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -17,7 +17,7 @@
 
 #if HAVE_LIMITS_H
 # include <limits.h>
-#endif 
+#endif
 
 #include <sys/dk.h>
 #include <sys/pstat.h>
@@ -38,7 +38,7 @@
 static uint64_t  lib_end_count[MAXCPUS];
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   return;
 }
@@ -64,7 +64,7 @@
         long long full;
         long      word[2];
       } *overlay;
-      
+
       psp = (struct pst_processor *)malloc(lib_num_loc_cpus * sizeof(*psp));
       if (psp == NULL) {
         printf("malloc(%d) failed!\n", lib_num_loc_cpus * sizeof(*psp));
@@ -102,31 +102,31 @@
     firstcnt[MAXCPUS],
     secondcnt[MAXCPUS];
 
-  float 
-    elapsed, 
+  float
+    elapsed,
     temp_rate,
     rate[MAXTIMES],
     local_maxrate;
 
-  long  
+  long
     sec,
     usec;
 
-  int   
+  int
     i,
     j;
-  
+
   long  count;
 
   struct  timeval time1, time2;
   struct  timezone tz;
 
   struct pst_processor *psp;
-  
+
   if (iterations > MAXTIMES) {
     iterations = MAXTIMES;
   }
-  
+
   local_maxrate = -1.0;
 
   psp = (struct pst_processor *)malloc(lib_num_loc_cpus * sizeof(*psp));
@@ -158,7 +158,7 @@
     gettimeofday (&time1, &tz);
     sleep(interval);
     gettimeofday (&time2, &tz);
-    
+
     if (time2.tv_usec < time1.tv_usec)
       {
         time2.tv_usec += 1000000;
@@ -195,8 +195,8 @@
                   hi_32(&secondcnt[j]),
                   lo_32(&secondcnt[j]));
         }
-        temp_rate = (secondcnt[j] >= firstcnt[j]) ? 
-          (float)(secondcnt[j] - firstcnt[j] )/elapsed : 
+        temp_rate = (secondcnt[j] >= firstcnt[j]) ?
+          (float)(secondcnt[j] - firstcnt[j] )/elapsed :
             (float)(secondcnt[j] - firstcnt[j] + LONG_LONG_MAX)/elapsed;
         if (temp_rate > rate[i]) rate[i] = temp_rate;
         if(debug) {
@@ -234,9 +234,9 @@
   /* calculations - for example, tests that were ended by */
   /* watchdog timers such as the udp stream test. We let these */
   /* tests tell up what the elapsed time should be. */
-  
+
   if (elapsed_time != 0.0) {
-    correction_factor = (float) 1.0 + 
+    correction_factor = (float) 1.0 +
       ((lib_elapsed - elapsed_time) / elapsed_time);
   }
   else {
@@ -246,15 +246,15 @@
   /* this looks just like the looper case. at least I think it */
   /* should :) raj 4/95 */
   for (i = 0; i < lib_num_loc_cpus; i++) {
-    
+
     /* we assume that the two are not more than a long apart. I */
     /* know that this is bad, but trying to go from long longs to */
     /* a float (perhaps a double) is boggling my mind right now. */
     /* raj 4/95 */
-    
-    long long 
+
+    long long
       diff;
-    
+
     if (lib_end_count[i] >= lib_start_count[i]) {
       diff = lib_end_count[i] - lib_start_count[i];
     }
@@ -276,10 +276,10 @@
 	      correction_factor);
     }
   }
-  
+
   /* we want the average across all n processors */
   lib_local_cpu_util /= (float)lib_num_loc_cpus;
-  
+
   if (debug) {
     fprintf(where,
 	    "calc_cpu_util: average across CPUs is %g\n",lib_local_cpu_util);

Modified: trunk/src/netcpu_pstatnew.c
===================================================================
--- trunk/src/netcpu_pstatnew.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_pstatnew.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -24,7 +24,7 @@
 
 #if HAVE_LIMITS_H
 # include <limits.h>
-#endif 
+#endif
 
 #include <sys/dk.h>
 #include <sys/pstat.h>
@@ -32,7 +32,7 @@
 /* HP-UX 11.23 seems to have added three other cycle counters to the
    original psp_idlecycles - one for user, one for kernel and one for
    interrupt. so, we can now use those to calculate CPU utilization
-   without requiring any calibration phase.  raj 2005-02-16 */ 
+   without requiring any calibration phase.  raj 2005-02-16 */
 
 #ifndef PSTAT_IPCINFO
 # error Sorry, pstat() CPU utilization on 10.0 and later only
@@ -73,7 +73,7 @@
 static long max_proc_count;
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   struct pst_dynamic psd;
   if (pstat_getdynamic((struct pst_dynamic *)&psd,
@@ -108,7 +108,7 @@
 	 only the bottom 32-bits are actually valid.  don't ask me
 	 why, that is just the way it is.  soo, we shift the psc_hi
 	 value by 32 bits and then just sum-in the psc_lo value.  raj
-	 2005/09/06 */ 
+	 2005/09/06 */
       struct pst_processor *psp;
 
       /* to handle the cases of "processors" present but disabled, we
@@ -189,7 +189,7 @@
 }
 
 static void
-print_cpu_time_counters(char *name, int instance, cpu_time_counters_t *counters) 
+print_cpu_time_counters(char *name, int instance, cpu_time_counters_t *counters)
 {
   fprintf(where,
 	  "%s[%d]:\n"
@@ -242,9 +242,9 @@
   /* calculations - for example, tests that were ended by */
   /* watchdog timers such as the udp stream test. We let these */
   /* tests tell up what the elapsed time should be. */
-  
+
   if (elapsed_time != 0.0) {
-    correction_factor = (float) 1.0 + 
+    correction_factor = (float) 1.0 +
       ((lib_elapsed - elapsed_time) / elapsed_time);
   }
   else {
@@ -278,13 +278,13 @@
      fix the interupt cycle accounting.  raj 2005/09/14 */
 
   /* calculate what the sum of CPU cycles _SHOULD_ be */
-  sanity_cpu_cycles = (uint64_t) ((double)lib_elapsed * 
+  sanity_cpu_cycles = (uint64_t) ((double)lib_elapsed *
     (double) sysconf(_SC_CLK_TCK) * (double)lib_iticksperclktick);
 
   /* this looks just like the looper case. at least I think it */
   /* should :) raj 4/95 */
   for (i = 0; i < lib_num_loc_cpus; i++) {
-    
+
     /* we ass-u-me that these counters will never wrap during a
        netperf run.  this may not be a particularly safe thing to
        do. raj 2005-01-28 */
@@ -296,14 +296,14 @@
       starting_cpu_counters[i].kernel;
     delta_cpu_counters[i].interrupt = ending_cpu_counters[i].interrupt -
       starting_cpu_counters[i].interrupt;
-    
+
     if (debug) {
       print_cpu_time_counters("delta_cpu_counters",i,delta_cpu_counters);
     }
 
     /* now get the sum, which we ass-u-me does not overflow a 64-bit
        counter. raj 2005-02-16 */
-    total_cpu_cycles = 
+    total_cpu_cycles =
       delta_cpu_counters[i].idle +
       delta_cpu_counters[i].user +
       delta_cpu_counters[i].kernel +
@@ -327,22 +327,22 @@
        we can use total_cpu_cycles rather than sanity_cpu_cycles, but
        until then, use sanity_cpu_ccles. raj 2005/09/14 */
 
-    fraction_idle = (double)delta_cpu_counters[i].idle / 
+    fraction_idle = (double)delta_cpu_counters[i].idle /
       (double)sanity_cpu_cycles;
 
-    fraction_user = (double)delta_cpu_counters[i].user / 
+    fraction_user = (double)delta_cpu_counters[i].user /
       (double)sanity_cpu_cycles;
 
-    fraction_kernel = (double) delta_cpu_counters[i].kernel / 
+    fraction_kernel = (double) delta_cpu_counters[i].kernel /
       (double)sanity_cpu_cycles;
 
-    fraction_interrupt = (double)delta_cpu_counters[i].interrupt / 
+    fraction_interrupt = (double)delta_cpu_counters[i].interrupt /
       (double)sanity_cpu_cycles;
 
     /* ass-u-me that it is only interrupt that is bogus, and assign
        all the "missing" cycles to it. raj 2005/09/14 */
     estimated_fraction_interrupt = ((double)delta_cpu_counters[i].interrupt +
-				    (sanity_cpu_cycles - total_cpu_cycles)) / 
+				    (sanity_cpu_cycles - total_cpu_cycles)) /
       (double)sanity_cpu_cycles;
 
     if (debug) {
@@ -376,22 +376,22 @@
        we can use total_cpu_cycles rather than sanity_cpu_cycles, but
        until then, use sanity_cpu_ccles. raj 2005/09/14 */
 
-    fraction_idle = 
+    fraction_idle =
       (delta_cpu_counters[i].idle * CALC_ACCURACY) / sanity_cpu_cycles;
 
-    fraction_user = 
+    fraction_user =
       (delta_cpu_counters[i].user * CALC_ACCURACY) / sanity_cpu_cycles;
 
-    fraction_kernel = 
+    fraction_kernel =
       (delta_cpu_counters[i].kernel * CALC_ACCURACY) / sanity_cpu_cycles;
 
-    fraction_interrupt = 
+    fraction_interrupt =
       (delta_cpu_counters[i].interrupt * CALC_ACCURACY) / sanity_cpu_cycles;
 
 
-    estimated_fraction_interrupt = 
-      ((delta_cpu_counters[i].interrupt + 
-	(sanity_cpu_cycles - total_cpu_cycles)) * 
+    estimated_fraction_interrupt =
+      ((delta_cpu_counters[i].interrupt +
+	(sanity_cpu_cycles - total_cpu_cycles)) *
        CALC_ACCURACY) / sanity_cpu_cycles;
 
     if (debug) {
@@ -409,7 +409,7 @@
     }
 
     /* and finally, what is our CPU utilization? */
-    lib_local_per_cpu_util[i] = 100.0 - (((float)fraction_idle / 
+    lib_local_per_cpu_util[i] = 100.0 - (((float)fraction_idle /
 					  (float)CALC_ACCURACY) * 100.0);
 #endif
     lib_local_per_cpu_util[i] *= correction_factor;

Modified: trunk/src/netcpu_sysctl.c
===================================================================
--- trunk/src/netcpu_sysctl.c	2012-01-31 22:27:31 UTC (rev 526)
+++ trunk/src/netcpu_sysctl.c	2012-02-01 02:14:49 UTC (rev 527)
@@ -64,7 +64,7 @@
 static CP_TIME_TYPE lib_end_count[CPUSTATES];
 
 void
-cpu_util_init(void) 
+cpu_util_init(void)
 {
   return;
 }



More information about the netperf-dev mailing list