fix cpu_info list size accounting

This commit is contained in:
Doug MacEachern 2008-04-11 17:25:11 +00:00
parent dd9575370a
commit e4c00a7b92
1 changed files with 3 additions and 2 deletions

View File

@ -213,6 +213,8 @@ char *sigar_os_error_string(sigar_t *sigar, int err)
static int sigar_cpu_total_count(sigar_t *sigar)
{
sigar->ncpu = (int)sysconf(_SC_NPROCESSORS_CONF);
sigar_log_printf(sigar, SIGAR_LOG_DEBUG, "[cpu] ncpu=%d\n",
sigar->ncpu);
return sigar->ncpu;
}
@ -1581,8 +1583,6 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
while (get_cpu_info(sigar, &cpu_infos->data[cpu_infos->number], fp)) {
sigar_cpu_info_t *cpu_info;
SIGAR_CPU_INFO_LIST_GROW(cpu_infos);
if (core_rollup && (i++ % sigar->lcpu)) {
continue; /* fold logical processors */
}
@ -1593,6 +1593,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
cpu_info->total_cores = sigar->ncpu;
++cpu_infos->number;
SIGAR_CPU_INFO_LIST_GROW(cpu_infos);
}
fclose(fp);