This commit is contained in:
Doug MacEachern 2004-09-06 18:14:50 +00:00
parent a733fa8a8b
commit c1ca086089
2 changed files with 15 additions and 3 deletions

View File

@ -9,6 +9,7 @@ int sigar_os_open(sigar_t **sigar)
(*sigar)->pagesize = getpagesize(); (*sigar)->pagesize = getpagesize();
(*sigar)->boot_time = 0; (*sigar)->boot_time = 0;
(*sigar)->mhz = 0;
return SIGAR_OK; return SIGAR_OK;
} }
@ -262,13 +263,23 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
{ {
sigar_cpu_info_t *info; sigar_cpu_info_t *info;
if (sigar->mhz == 0) {
struct tbl_sysinfo sysinfo;
if (table(TBL_SYSINFO, 0, &sysinfo, 1, sizeof(sysinfo)) != 1) {
return errno;
}
sigar->mhz = sysinfo.si_hz;
}
sigar_cpu_info_list_create(cpu_infos); sigar_cpu_info_list_create(cpu_infos);
info = &cpu_infos->data[cpu_infos->number++]; info = &cpu_infos->data[cpu_infos->number++];
SIGAR_SSTRCPY(info->vendor, "vendor"); SIGAR_SSTRCPY(info->vendor, "DEC");
SIGAR_SSTRCPY(info->model, "model"); SIGAR_SSTRCPY(info->model, "alpha");
info->mhz = -1; info->mhz = sigar->mhz;
info->cache_size = -1; info->cache_size = -1;
return SIGAR_OK; return SIGAR_OK;

View File

@ -17,6 +17,7 @@
struct sigar_t { struct sigar_t {
SIGAR_T_BASE; SIGAR_T_BASE;
int pagesize; int pagesize;
int mhz;
}; };
#endif /* SIGAR_OS_H */ #endif /* SIGAR_OS_H */