From 7852029a84bd2d88a0dfd9cb125dc3dda5efa1fc Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 12 Feb 2005 00:18:00 +0000 Subject: [PATCH] freebsd cpu mhz --- src/os/darwin/darwin_sigar.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index 5030f2ae..45b27adf 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -791,6 +791,13 @@ int sigar_file_system_usage_get(sigar_t *sigar, return SIGAR_OK; } +#ifdef DARWIN +#define CTL_HW_FREQ "hw.cpufrequency" +#else +/* XXX FreeBSD 5.x+ only? */ +#define CTL_HW_FREQ "machdep.tsc_freq" +#endif + int sigar_cpu_info_list_get(sigar_t *sigar, sigar_cpu_info_list_t *cpu_infos) { @@ -799,7 +806,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar, size_t size; size = sizeof(value); - if (!sysctlbyname("hw.cpufrequency", &value, &size, NULL, 0)) { + if (!sysctlbyname(CTL_HW_FREQ, &value, &size, NULL, 0)) { mhz = value; } else {