Created
September 28, 2010 13:25
-
-
Save djcas9/600982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* CPU STATS - at the end of output record */ | |
#ifdef LINUX_SMP | |
/* First the number of CPUs */ | |
fprintf(fh, "%d,", sfBaseStats->sfProcPidStats->iCPUs); | |
/* Next, stats for each CPU (a triple) */ | |
for(iCtr = 0; iCtr < sfBaseStats->sfProcPidStats->iCPUs; iCtr++) | |
{ | |
usr= sfBaseStats->sfProcPidStats->SysCPUs[iCtr].user; | |
sys= sfBaseStats->sfProcPidStats->SysCPUs[iCtr].sys; | |
idle= sfBaseStats->sfProcPidStats->SysCPUs[iCtr].idle; | |
fprintf(fh,"%.3f,%.3f,%.3f,",usr,sys,idle); | |
} | |
#else | |
usr=sfBaseStats->user_cpu_time; | |
sys=sfBaseStats->system_cpu_time; | |
idle=sfBaseStats->idle_cpu_time; | |
/* 1 CPU hardcoded */ | |
fprintf(fh,"1,%.3f,%.3f,%.3f,",usr,sys,idle); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment