add some debug info to cpu_list

This commit is contained in:
Doug MacEachern 2006-12-04 20:00:58 +00:00
parent 228ee133be
commit 3676a936de
1 changed files with 14 additions and 0 deletions

View File

@ -360,6 +360,8 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
kstat_t *ksp; kstat_t *ksp;
ulong cpuinfo[CPU_STATES]; ulong cpuinfo[CPU_STATES];
unsigned int i; unsigned int i;
int is_debug = SIGAR_LOG_IS_DEBUG(sigar);
int reported_virtual = 0;
if (sigar_kstat_update(sigar) == -1) { if (sigar_kstat_update(sigar) == -1) {
return errno; return errno;
@ -379,6 +381,12 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
sigar_cpu_list_create(cpulist); sigar_cpu_list_create(cpulist);
} }
if (is_debug) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[cpu_list] OS reports %d CPUs",
sigar->ncpu);
}
for (i=0; i<sigar->ncpu; i++) { for (i=0; i<sigar->ncpu; i++) {
sigar_cpu_t *cpu; sigar_cpu_t *cpu;
char *buf; char *buf;
@ -427,6 +435,12 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
if (is_same_chip(sigar, i, cpulist->number)) { if (is_same_chip(sigar, i, cpulist->number)) {
/* merge times of logical processors */ /* merge times of logical processors */
cpu = &cpulist->data[cpulist->number-1]; cpu = &cpulist->data[cpulist->number-1];
if (is_debug && !reported_virtual++) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[cpu_list] Merging times of"
" logical processors");
}
} }
else { else {
SIGAR_CPU_LIST_GROW(cpulist); SIGAR_CPU_LIST_GROW(cpulist);