[SIGAR-14] Fix sigar_cpu_t.total on Linux and Solaris with multi-core CPUs

This commit is contained in:
Doug MacEachern 2006-09-07 14:10:24 +00:00
parent d8159a6024
commit 9d7275a29b
3 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2006-09-07 Doug MacEachern <dougm@hyperic.com>
* [SIGAR-14] Fix sigar_cpu_t.total on Linux and Solaris with multi-core CPUs
2006-08-25 Doug MacEachern <dougm@hyperic.com>
* Implement proc_env for Darwin

View File

@ -431,7 +431,7 @@ static void get_cpu_metrics(sigar_t *sigar, sigar_cpu_t *cpu, char *line)
/* 2.6+ kernels only */
cpu->wait += SIGAR_TICK2SEC(sigar_strtoul(ptr));
}
cpu->total += cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->wait;
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle + cpu->wait;
}
int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)

View File

@ -293,7 +293,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
cpu->idle += xcpu->idle;
cpu->nice += xcpu->nice;
cpu->wait += xcpu->wait;
cpu->total += xcpu->total;
cpu->total = xcpu->total;
}
return SIGAR_OK;
@ -384,7 +384,7 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
cpu->idle += SIGAR_TICK2SEC(cpuinfo[CPU_IDLE]);
cpu->wait += SIGAR_TICK2SEC(cpuinfo[CPU_WAIT]);
cpu->nice += 0; /* no cpu->nice */
cpu->total += cpu->user + cpu->sys + cpu->idle + cpu->wait;
cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
}
return SIGAR_OK;