freebsd cpu mhz

This commit is contained in:
Doug MacEachern 2005-02-12 00:18:00 +00:00
parent ffd6610ea9
commit 7852029a84
1 changed files with 8 additions and 1 deletions

View File

@ -791,6 +791,13 @@ int sigar_file_system_usage_get(sigar_t *sigar,
return SIGAR_OK; 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, int sigar_cpu_info_list_get(sigar_t *sigar,
sigar_cpu_info_list_t *cpu_infos) sigar_cpu_info_list_t *cpu_infos)
{ {
@ -799,7 +806,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
size_t size; size_t size;
size = sizeof(value); size = sizeof(value);
if (!sysctlbyname("hw.cpufrequency", &value, &size, NULL, 0)) { if (!sysctlbyname(CTL_HW_FREQ, &value, &size, NULL, 0)) {
mhz = value; mhz = value;
} }
else { else {