fold hp specific cpu states

This commit is contained in:
Doug MacEachern 2005-05-12 02:45:08 +00:00
parent b5b16908a3
commit 9101d2d95e
1 changed files with 12 additions and 10 deletions

View File

@ -95,20 +95,22 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
static void get_cpu_metrics(sigar_t *sigar, static void get_cpu_metrics(sigar_t *sigar,
sigar_cpu_t *cpu, int32_t *cpu_time) sigar_cpu_t *cpu, int32_t *cpu_time)
{ {
int i;
cpu->user = SIGAR_TICK2SEC(cpu_time[CP_USER]); cpu->user = SIGAR_TICK2SEC(cpu_time[CP_USER]);
cpu->sys = SIGAR_TICK2SEC(cpu_time[CP_SYS] + cpu_time[CP_SSYS]);
cpu->sys = SIGAR_TICK2SEC(cpu_time[CP_SYS] +
cpu_time[CP_SSYS] +
cpu_time[CP_INTR]);
cpu->nice = SIGAR_TICK2SEC(cpu_time[CP_NICE]); cpu->nice = SIGAR_TICK2SEC(cpu_time[CP_NICE]);
cpu->idle = SIGAR_TICK2SEC(cpu_time[CP_IDLE]); cpu->idle = SIGAR_TICK2SEC(cpu_time[CP_IDLE]);
cpu->wait = SIGAR_TICK2SEC(cpu_time[CP_WAIT]);
cpu->wait = SIGAR_TICK2SEC(cpu_time[CP_WAIT] +
cpu_time[CP_SWAIT] +
cpu_time[CP_BLOCK]);
cpu->total = 0; cpu->total =
cpu->user + cpu->sys + cpu->nice + cpu->idle + cpu->wait;
/* states above plus CP_BLOCK, CP_SWAIT, etc. (see sys/dk.h) */
for (i=0; i<CPUSTATES; i++) {
cpu->total += SIGAR_TICK2SEC(cpu_time[i]);
}
} }
int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu) int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)