Skip to content

Commit 8e52c18

Browse files
authored
fix for issue #161 (#175)
* fix for issue #161 * cargo fmt! * fix: update libc version to 0.2.179 and sysinfo source reference * bump zenith version to 0.14.3
1 parent 8ce378c commit 8e52c18

4 files changed

Lines changed: 13 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zenith"
3-
version = "0.14.2"
3+
version = "0.14.3"
44
authors = ["Benjamin Vaisvil"]
55
edition = "2018"
66
description = "Similar to top or htop but with CPU, Network Usage, and Disk Usage charts."
@@ -29,7 +29,7 @@ heim = { git = "https://github.com/bvaisvil/heim.git", branch = "zenith_changes"
2929
futures = "0.3.31"
3030
gumdrop = { version = "~0.8.1", features = ["default_expr"] }
3131
chrono = "~0.4.39"
32-
sysinfo = { git = "https://github.com/bvaisvil/sysinfo.git", branch = "zenith_changes_15.1" }
32+
sysinfo = { git = "https://github.com/bvaisvil/sysinfo.git", branch = "zenith_changes_15.1_mem_fix" }
3333
dirs-next = "2.0.0"
3434
serde = { version = "~1.0.217", features = ["derive"] }
3535
serde_derive = "~1.0.217"

src/renderer/cpu.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ fn mem_title(app: &'_ CPUTimeApp) -> Line<'_> {
109109
Span::styled(
110110
format!(
111111
"{} / {} - {:}%",
112-
float_to_byte_string!(app.mem_utilization as f64, Unit::KB),
113-
float_to_byte_string!(app.mem_total as f64, Unit::KB),
112+
float_to_byte_string!(app.mem_utilization as f64, Unit::B),
113+
float_to_byte_string!(app.mem_total as f64, Unit::B),
114114
mem
115115
),
116116
if mem > 95 { max_style() } else { ok_style() },
@@ -119,8 +119,8 @@ fn mem_title(app: &'_ CPUTimeApp) -> Line<'_> {
119119
Span::styled(
120120
format!(
121121
"{} / {} - {:}%",
122-
float_to_byte_string!(app.swap_utilization as f64, Unit::KB),
123-
float_to_byte_string!(app.swap_total as f64, Unit::KB),
122+
float_to_byte_string!(app.swap_utilization as f64, Unit::B),
123+
float_to_byte_string!(app.swap_total as f64, Unit::B),
124124
swp,
125125
),
126126
if swp > 20 { max_style() } else { ok_style() },

src/renderer/macros.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
macro_rules! float_to_byte_string {
66
($x:expr, $unit:expr) => {
77
match Byte::from_f64_with_unit($x, $unit) {
8-
Some(b) => format!(
9-
"{:.2}",
10-
b.get_appropriate_unit(byte_unit::UnitType::Decimal)
11-
)
12-
.replace(" ", ""),
8+
Some(b) => format!("{:.2}", b.get_appropriate_unit(byte_unit::UnitType::Binary))
9+
.replace(" ", "")
10+
.replace("iB", ""),
1311
None => String::from("Err"),
1412
}
1513
};

0 commit comments

Comments
 (0)