assume Xeon on redhat AS 2.1 is HT enabled

This commit is contained in:
Doug MacEachern 2004-08-11 22:44:38 +00:00
parent 2d3a408648
commit a79bb600b9
1 changed files with 14 additions and 1 deletions

View File

@ -1078,7 +1078,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
sigar_cpu_info_list_t *cpu_infos)
{
FILE *fp;
int id;
int id, fake_id = -1;
int cpu_id[36], cpu_ix=0;
/* in the event that a box has > 36 cpus */
int cpu_id_max = sizeof(cpu_id)/sizeof(int);
@ -1093,6 +1093,8 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
memset(&cpu_id[0], -1, sizeof(cpu_id));
while (get_cpu_info(sigar, &cpu_infos->data[cpu_infos->number], fp, &id)) {
fake_id++;
if (id >= 0) {
int i, fold=0;
for (i=0; (i<cpu_ix) && (i<cpu_id_max); i++) {
@ -1115,6 +1117,17 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
}
}
}
else if (strEQ(cpu_infos->data[cpu_infos->number].model, "Xeon")) {
/* Redhat AS 2.1 /proc/cpuinfo does not have any of the
* attributes we use to detect hyperthreading, in this case
* if model Xeon, assume HT enabled. FUCK IT.
*/
if (fake_id % 2) {
sigar->ht_enabled = 1;
sigar->lcpu = 2; /* XXX assume 2 for now */
continue;
}
}
++cpu_infos->number;
SIGAR_CPU_INFO_LIST_GROW(cpu_infos);