dont hardcode 2 logical processors if ht_enabled
This commit is contained in:
parent
003d416408
commit
903c369671
|
@ -241,9 +241,11 @@ unsigned int sigar_cpu_count(sigar_t *sigar)
|
||||||
|
|
||||||
if (status == HT_ENABLED) {
|
if (status == HT_ENABLED) {
|
||||||
sigar->ht_enabled = 1;
|
sigar->ht_enabled = 1;
|
||||||
|
sigar->lcpu = LogicalNum;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sigar->ht_enabled = 0;
|
sigar->ht_enabled = 0;
|
||||||
|
sigar->lcpu = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sigar->ncpu;
|
return sigar->ncpu;
|
||||||
|
|
|
@ -113,6 +113,7 @@ struct sigar_t {
|
||||||
int ws_error;
|
int ws_error;
|
||||||
LPBYTE peb; //scratch pad for getting peb info
|
LPBYTE peb; //scratch pad for getting peb info
|
||||||
int ht_enabled;
|
int ht_enabled;
|
||||||
|
int lcpu; //number of logical cpus
|
||||||
int winnt;
|
int winnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ SIGAR_DECLARE(int) sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
|
||||||
* for each logical processor.
|
* for each logical processor.
|
||||||
* XXX assuming this is correct until have something to test on.
|
* XXX assuming this is correct until have something to test on.
|
||||||
*/
|
*/
|
||||||
if (sigar->ht_enabled && ((sigar->ncpu * 2) == num)) {
|
if (sigar->ht_enabled && ((sigar->ncpu * sigar->lcpu) == num)) {
|
||||||
hthread = 1;
|
hthread = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ SIGAR_DECLARE(int) sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
|
||||||
PERF_COUNTER_BLOCK *counter_block;
|
PERF_COUNTER_BLOCK *counter_block;
|
||||||
sigar_cpu_t *cpu;
|
sigar_cpu_t *cpu;
|
||||||
|
|
||||||
if (hthread && (i % 2)) {
|
if (hthread && (i % sigar->lcpu)) {
|
||||||
/* merge times of logical processors */
|
/* merge times of logical processors */
|
||||||
cpu = &cpulist->data[cpulist->number-1];
|
cpu = &cpulist->data[cpulist->number-1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue