From 9101d2d95ea1583fb5704a604d21d3bcab8dd041 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 12 May 2005 02:45:08 +0000 Subject: [PATCH] fold hp specific cpu states --- src/os/hpux/hpux_sigar.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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)