move cpuid from os/linux to sigar_util for use on other platforms

This commit is contained in:
Doug MacEachern committed 2008-04-09 06:29:08 +00:00
1 parent 277cf2e68e
commit 2b9c8971e0
5 files changed
+118 -104

No files matched your search

+7 -2
View File
@@ -253,6 +253,7 @@ int sigar_os_open(sigar_t **sigar)
#endif
(*sigar)->ncpu = ncpu;
(*sigar)->lcpu = -1;
(*sigar)->boot_time = boottime.tv_sec; /* XXX seems off a bit */
@@ -2017,7 +2018,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
int sigar_cpu_info_list_get(sigar_t *sigar,
sigar_cpu_info_list_t *cpu_infos)
{
int i;
int i, lcpu=1;
unsigned int mhz;
int cache_size=SIGAR_FIELD_NOTIMPL;
size_t size;
@@ -2025,6 +2026,10 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
size = sizeof(mhz);
#if defined(DARWIN)
lcpu = sigar_cpu_core_count(sigar);
#endif
#if defined(DARWIN)
{
int mib[] = { CTL_HW, HW_CPU_FREQ };
@@ -2124,7 +2129,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
info->mhz = mhz;
info->cache_size = cache_size;
info->total_cores = sigar->ncpu;
info->total_sockets = sigar->ncpu;
info->total_sockets = sigar->ncpu / lcpu;
}
return SIGAR_OK;