diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index 10f63a61..2f7fc839 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -95,20 +95,22 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap) static void get_cpu_metrics(sigar_t *sigar, sigar_cpu_t *cpu, int32_t *cpu_time) { - int i; - 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->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; - - /* states above plus CP_BLOCK, CP_SWAIT, etc. (see sys/dk.h) */ - for (i=0; itotal += SIGAR_TICK2SEC(cpu_time[i]); - } + cpu->total = + cpu->user + cpu->sys + cpu->nice + cpu->idle + cpu->wait; } int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)