diff options
author | Jos Dehaes <jos.dehaes@gmail.com> | 2021-10-23 22:58:17 +0200 |
---|---|---|
committer | Jos Dehaes <jos.dehaes@gmail.com> | 2021-10-23 22:58:17 +0200 |
commit | 30ef6ee05057c6bbb0ddc96b7897de31e692907c (patch) | |
tree | 6e0623d4608b6c8bd08d91f11563a02d18cc4e3d | |
parent | 735894b6caddedcf69a200e9d29cf0115c08bcce (diff) |
cpu freq
-rw-r--r-- | src/freebsd/btop_collect.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/freebsd/btop_collect.cpp b/src/freebsd/btop_collect.cpp index 2ece158..40001ff 100644 --- a/src/freebsd/btop_collect.cpp +++ b/src/freebsd/btop_collect.cpp @@ -242,13 +242,10 @@ namespace Cpu { unsigned int freq = 1; size_t size = sizeof(freq); - int mib[] = {CTL_KERN, KERN_CLOCKRATE}; - - if (sysctl(mib, 2, &freq, &size, NULL, 0) < 0) { - // this fails on Apple Silicon macs. Apparently you're not allowed to know + if (sysctlbyname("dev.cpu.0.freq", &freq, &size, NULL, 0) < 0) { return ""; } - return std::to_string(freq / 1000.0 / 1000.0 / 1000.0).substr(0, 3); + return std::to_string(freq / 1000.0 ).substr(0, 3); // seems to be in MHz } auto get_core_mapping() -> unordered_flat_map<int, int> { |