Fix memory display

This commit is contained in:
FliegendeWurst 2019-03-05 11:59:16 +01:00
parent e92a608151
commit 2322feb5b7
No known key found for this signature in database
GPG Key ID: CA38E82B54B32A88

View File

@ -11,5 +11,5 @@ fn main() {
let mut meminfo = meminfo.split('\n'); let mut meminfo = meminfo.split('\n');
let total = meminfo.next().unwrap().split_whitespace().nth(1).unwrap().parse::<u64>().unwrap() / 1_000; let total = meminfo.next().unwrap().split_whitespace().nth(1).unwrap().parse::<u64>().unwrap() / 1_000;
let available = meminfo.nth(1).unwrap().split_whitespace().nth(1).unwrap().parse::<u64>().unwrap() / 1_000; let available = meminfo.nth(1).unwrap().split_whitespace().nth(1).unwrap().parse::<u64>().unwrap() / 1_000;
println!("{:.1}% {:.1}°C {}/{}MB", load / num_cpus * 100.0, temp, available, total); println!("{:.1}% {:.1}°C {}/{}MB", load / num_cpus * 100.0, temp, total - available, total);
} }