diff options
author | Jos Dehaes <jos.dehaes@gmail.com> | 2021-10-01 17:05:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 17:05:26 +0200 |
commit | 7bfbd83a476c8cbe3b74e22b1e44f201026bf9d1 (patch) | |
tree | da9f49b7539463d2579a0bde0b4dc0b51691ffab | |
parent | 8c8139bd1df0849061b5e1425a3138d5f45ec149 (diff) | |
parent | a15f961b2f0fe642ee61e2331c0d109fab7e9b05 (diff) |
Merge branch 'aristocratos:main' into main
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | src/btop.cpp | 2 | ||||
-rw-r--r-- | src/btop_draw.cpp | 1 | ||||
-rw-r--r-- | src/btop_tools.cpp | 3 | ||||
-rw-r--r-- | src/linux/btop_collect.cpp | 5 |
5 files changed, 10 insertions, 4 deletions
@@ -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)** diff --git a/src/btop.cpp b/src/btop.cpp index 6486f98..dbbf3a6 100644 --- a/src/btop.cpp +++ b/src/btop.cpp @@ -55,7 +55,7 @@ namespace Global { {"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"}, {"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"}, }; - const string Version = "1.0.11"; + const string Version = "1.0.12"; int coreCount; string overlay; diff --git a/src/btop_draw.cpp b/src/btop_draw.cpp index 0234d3a..7406d15 100644 --- a/src/btop_draw.cpp +++ b/src/btop_draw.cpp @@ -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) : ""); diff --git a/src/btop_tools.cpp b/src/btop_tools.cpp index c897b1b..bb75f2f 100644 --- a/src/btop_tools.cpp +++ b/src/btop_tools.cpp @@ -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); } diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index d8ea597..56730e7 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -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)); |