From c1ca0860893f5b58bec0409e8967af28d696e84e Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 6 Sep 2004 18:14:50 +0000 Subject: [PATCH] cpu_info --- src/os/osf1/osf1_sigar.c | 17 ++++++++++++++--- src/os/osf1/sigar_os.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/os/osf1/osf1_sigar.c b/src/os/osf1/osf1_sigar.c index 7171fa6b..ba08f460 100644 --- a/src/os/osf1/osf1_sigar.c +++ b/src/os/osf1/osf1_sigar.c @@ -9,6 +9,7 @@ int sigar_os_open(sigar_t **sigar) (*sigar)->pagesize = getpagesize(); (*sigar)->boot_time = 0; + (*sigar)->mhz = 0; return SIGAR_OK; } @@ -262,13 +263,23 @@ int sigar_cpu_info_list_get(sigar_t *sigar, { 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); info = &cpu_infos->data[cpu_infos->number++]; - SIGAR_SSTRCPY(info->vendor, "vendor"); - SIGAR_SSTRCPY(info->model, "model"); - info->mhz = -1; + SIGAR_SSTRCPY(info->vendor, "DEC"); + SIGAR_SSTRCPY(info->model, "alpha"); + info->mhz = sigar->mhz; info->cache_size = -1; return SIGAR_OK; diff --git a/src/os/osf1/sigar_os.h b/src/os/osf1/sigar_os.h index 147a4ede..124d01bb 100644 --- a/src/os/osf1/sigar_os.h +++ b/src/os/osf1/sigar_os.h @@ -17,6 +17,7 @@ struct sigar_t { SIGAR_T_BASE; int pagesize; + int mhz; }; #endif /* SIGAR_OS_H */