mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-10 14:44:18 +00:00
fix wrong unit being used for memory in sysinfo data (#824)
* fix wrong unit being used for memory in sysinfo data * update sysinfo to 0.26.4 for unsupported reasons w/ ntapi
This commit is contained in:
parent
f44aac189c
commit
a965e53c6c
5 changed files with 19 additions and 10 deletions
19
Cargo.lock
generated
19
Cargo.lock
generated
|
@ -775,7 +775,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"libc",
|
||||
"mach",
|
||||
"ntapi",
|
||||
"ntapi 0.3.7",
|
||||
"smol",
|
||||
"winapi",
|
||||
]
|
||||
|
@ -1000,7 +1000,7 @@ dependencies = [
|
|||
"libc",
|
||||
"log",
|
||||
"miow",
|
||||
"ntapi",
|
||||
"ntapi 0.3.7",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -1064,6 +1064,15 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.44"
|
||||
|
@ -1536,14 +1545,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.26.2"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ae2421f3e16b3afd4aa692d23b83d0ba42ee9b0081d5deeb7d21428d7195fb1"
|
||||
checksum = "7890fff842b8db56f2033ebee8f6efe1921475c3830c115995552914fb967580"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys 0.8.3",
|
||||
"libc",
|
||||
"ntapi",
|
||||
"ntapi 0.4.0",
|
||||
"once_cell",
|
||||
"rayon",
|
||||
"winapi",
|
||||
|
|
|
@ -74,7 +74,7 @@ once_cell = "1.5.2"
|
|||
regex = "1.5.5"
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
starship-battery = { version = "0.7.9", optional = true }
|
||||
sysinfo = "0.26.2"
|
||||
sysinfo = "0.26.4"
|
||||
thiserror = "1.0.30"
|
||||
time = { version = "0.3.9", features = ["formatting", "macros"] }
|
||||
toml = "0.5.9"
|
||||
|
|
|
@ -20,7 +20,7 @@ pub async fn get_mem_data(
|
|||
}
|
||||
|
||||
pub async fn get_ram_data(sys: &System) -> crate::utils::error::Result<Option<MemHarvest>> {
|
||||
let (mem_total_in_kib, mem_used_in_kib) = (sys.total_memory(), sys.used_memory());
|
||||
let (mem_total_in_kib, mem_used_in_kib) = (sys.total_memory() / 1024, sys.used_memory()) / 1024;
|
||||
|
||||
Ok(Some(MemHarvest {
|
||||
mem_total_in_kib,
|
||||
|
@ -34,7 +34,7 @@ pub async fn get_ram_data(sys: &System) -> crate::utils::error::Result<Option<Me
|
|||
}
|
||||
|
||||
pub async fn get_swap_data(sys: &System) -> crate::utils::error::Result<Option<MemHarvest>> {
|
||||
let (mem_total_in_kib, mem_used_in_kib) = (sys.total_swap(), sys.used_swap());
|
||||
let (mem_total_in_kib, mem_used_in_kib) = (sys.total_swap() / 1024, sys.used_swap() / 1024);
|
||||
|
||||
Ok(Some(MemHarvest {
|
||||
mem_total_in_kib,
|
||||
|
|
|
@ -76,7 +76,7 @@ pub fn get_process_data(
|
|||
} else {
|
||||
0.0
|
||||
},
|
||||
mem_usage_bytes: process_val.memory() * 1024,
|
||||
mem_usage_bytes: process_val.memory(),
|
||||
cpu_usage_percent: process_cpu_usage,
|
||||
read_bytes_per_sec: disk_usage.read_bytes,
|
||||
write_bytes_per_sec: disk_usage.written_bytes,
|
||||
|
|
|
@ -66,7 +66,7 @@ pub fn get_process_data(
|
|||
} else {
|
||||
0.0
|
||||
},
|
||||
mem_usage_bytes: process_val.memory() * 1024,
|
||||
mem_usage_bytes: process_val.memory(),
|
||||
cpu_usage_percent: process_cpu_usage,
|
||||
read_bytes_per_sec: disk_usage.read_bytes,
|
||||
write_bytes_per_sec: disk_usage.written_bytes,
|
||||
|
|
Loading…
Reference in a new issue