[SIGAR-14] Fix sigar_cpu_t.total on Linux and Solaris with multi-core CPUs
This commit is contained in:
1 parent
d8159a6024
commit
9d7275a29b
3 files changed
+7
-3
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user