Merge branch 'main' of github.com:joske/btop

This commit is contained in:
Jos Dehaes 2021-10-02 23:48:43 +02:00
commit 6e704ce838
5 changed files with 10 additions and 4 deletions

View file

@ -7,7 +7,7 @@
![Linux](https://img.shields.io/badge/-Linux-grey?logo=linux)
![Usage](https://img.shields.io/badge/Usage-System%20resource%20monitor-yellow)
![c++20](https://img.shields.io/badge/cpp-c%2B%2B20-green)
![btop_version](https://img.shields.io/github/v/tag/aristocratos/btop?label=version)
![latest_release](https://img.shields.io/github/v/tag/aristocratos/btop?label=release)
[![Donate](https://img.shields.io/badge/-Donate-yellow?logo=paypal)](https://paypal.me/aristocratos)
[![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/aristocratos)
[![Coffee](https://img.shields.io/badge/-Buy%20me%20a%20Coffee-grey?logo=Ko-fi)](https://ko-fi.com/aristocratos)
@ -124,6 +124,7 @@ Also needs a UTF8 locale and a font that covers:
* Unicode Block “Braille Patterns” U+2800 - U+28FF (Not needed in TTY mode or with graphs set to type: block or tty.)
* Unicode Block “Geometric Shapes” U+25A0 - U+25FF
* Unicode Block "Box Drawing" and "Block Elements" U+2500 - U+259F
* Unicode Block "General punctuation" U+2005
### **Notice (Text rendering issues)**

View file

@ -55,7 +55,7 @@ namespace Global {
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
};
const string Version = "1.0.11";
const string Version = "1.0.12";
int coreCount;
string overlay;

View file

@ -1418,6 +1418,7 @@ namespace Proc {
else if (p.cpu_p >= 10'000) {
cpu_str = to_string(p.cpu_p / 1000);
cpu_str.resize(3);
if (cpu_str.ends_with('.')) cpu_str.pop_back();
cpu_str += "k";
}
string mem_str = (mem_bytes ? floating_humanizer(p.mem, true) : "");

View file

@ -339,7 +339,8 @@ namespace Tools {
for (string readstr; getline(file, readstr); out += readstr);
}
catch (const std::exception& e) {
throw std::runtime_error("readfile() : Exception when reading " + (string)path + " : " + e.what());
Logger::error("readfile() : Exception when reading " + (string)path + " : " + e.what());
return fallback;
}
return (out.empty() ? fallback : out);
}

View file

@ -1007,7 +1007,10 @@ namespace Net {
auto& saved_stat = net.at(iface).stat.at(dir);
auto& bandwidth = net.at(iface).bandwidth.at(dir);
const uint64_t val = max((uint64_t)stoul(readfile(sys_file, "0")), saved_stat.last);
uint64_t val = saved_stat.last;
try { val = max((uint64_t)stoul(readfile(sys_file, "0")), val); }
catch (const std::invalid_argument&) {}
catch (const std::out_of_range&) {}
//? Update speed, total and top values
saved_stat.speed = round((double)(val - saved_stat.last) / ((double)(new_timestamp - timestamp) / 1000));