From cf51ba2ebe88dddd943040ced484581dc260c3c8 Mon Sep 17 00:00:00 2001 From: Jos Dehaes Date: Wed, 6 Oct 2021 14:45:44 +0200 Subject: [PATCH] remove some warnings --- src/osx/btop_collect.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/osx/btop_collect.cpp b/src/osx/btop_collect.cpp index a039898..06cf445 100644 --- a/src/osx/btop_collect.cpp +++ b/src/osx/btop_collect.cpp @@ -262,12 +262,12 @@ namespace Cpu { } string get_cpuHz() { - uint64_t freq = 0; + int64_t freq = 1; size_t size = sizeof(freq); - return "1.0"; if (sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0) < 0) { - Logger::error("Failed to get CPU frequency"); + char *err = strerror(errno); + Logger::error("Failed to get CPU frequency: " + string(err)); } return std::to_string(freq); } @@ -489,7 +489,6 @@ namespace Mem { auto &show_swap = Config::getB("show_swap"); auto &show_disks = Config::getB("show_disks"); auto &swap_disk = Config::getB("swap_disk"); - auto totalMem = get_totalMem(); auto &mem = current_mem; static const bool snapped = (getenv("BTOP_SNAPPED") != NULL); @@ -532,7 +531,7 @@ namespace Mem { double uptime = system_uptime(); auto &disks_filter = Config::getS("disks_filter"); bool filter_exclude = false; - auto &only_physical = Config::getB("only_physical"); + // auto &only_physical = Config::getB("only_physical"); auto &disks = mem.disks; vector filter; if (not disks_filter.empty()) { @@ -1000,11 +999,9 @@ namespace Proc { found.push_back(pid); //? Check if pid already exists in current_procs auto find_old = rng::find(current_procs, pid, &proc_info::pid); - bool no_cache = false; if (find_old == current_procs.end()) { current_procs.push_back(p); find_old = current_procs.end() - 1; - no_cache = true; } //? Process cpu usage since last update p.cpu_p = clamp(round(cmult * 1000 * (cpu_t - p.cpu_t) / max((uint64_t)1, cputimes - old_cputimes)) / 10.0, 0.0, 100.0 * Shared::coreCount);