Skip to content

Commit

Permalink
Fixed: Cpu::collect() core count counter...
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed Oct 5, 2022
1 parent 2b02a66 commit 0cb31e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/linux/btop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ namespace Cpu {
for (; i <= Shared::coreCount; i++) {

//? Make sure to add zero value for missing core values if at end of file
if ((not cread.good() or cread.peek() != 'c') and i < Shared::coreCount) {
if ((not cread.good() or cread.peek() != 'c') and i <= Shared::coreCount) {
if (i == 0) throw std::runtime_error("Failed to parse /proc/stat");
else cpu.core_percent.at(i-1).push_back(0);
}
Expand Down Expand Up @@ -758,9 +758,9 @@ namespace Cpu {
if (i < Shared::coreCount + 1) throw std::runtime_error("Failed to parse /proc/stat");
}
catch (const std::exception& e) {
Logger::debug("get_cpuHz() : " + string{e.what()});
Logger::debug("Cpu::collect() : " + string{e.what()});
if (cread.bad()) throw std::runtime_error("Failed to read /proc/stat");
else throw std::runtime_error("collect() : " + string{e.what()});
else throw std::runtime_error("Cpu::collect() : " + string{e.what()});
}

if (Config::getB("show_cpu_freq"))
Expand Down

0 comments on commit 0cb31e7

Please sign in to comment.