diff options
author | Jos Dehaes <jos.dehaes@gmail.com> | 2021-10-06 15:55:58 +0200 |
---|---|---|
committer | Jos Dehaes <jos.dehaes@gmail.com> | 2021-10-06 15:55:58 +0200 |
commit | b9d58e3faf5b60ad4f5f65454b454ff52deb5eaa (patch) | |
tree | c9f8a1f5e7bc884f58c553563a47728d5daa5254 | |
parent | 66072711c24b2694c4a0054c58829095ed97ada2 (diff) |
impossible to get CPU freq on M1 apparently
-rw-r--r-- | src/osx/btop_collect.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/osx/btop_collect.cpp b/src/osx/btop_collect.cpp index 161ceac..c5e5514 100644 --- a/src/osx/btop_collect.cpp +++ b/src/osx/btop_collect.cpp @@ -271,6 +271,7 @@ namespace Cpu { if (sysctl(mib, 2, &freq, &size, NULL, 0) < 0) { Logger::error("Failed to get CPU frequency: " + std::to_string(errno)); + return ""; } return std::to_string(freq / 1000.0 / 1000.0 / 1000.0).substr(0, 3); } @@ -463,8 +464,12 @@ namespace Cpu { //? Reduce size if there are more values than needed for graph while (cmp_greater(cpu.cpu_percent.at("total").size(), width * 2)) cpu.cpu_percent.at("total").pop_front(); - if (Config::getB("show_cpu_freq")) - cpuHz = get_cpuHz(); + if (Config::getB("show_cpu_freq")) { + auto hz = get_cpuHz(); + if (hz != "") { + cpuHz = hz; + } + } if (Config::getB("check_temp") and got_sensors) update_sensors(); |