|
|
@ -35,10 +35,10 @@ impl Builtin for Fetch { |
|
|
|
println!("{} {}", "UPTIME".red().bold(), format_uptime(sys.uptime()));
|
|
|
|
println!("{} {}", "CPU".magenta().bold(), sys.cpus()[0].brand());
|
|
|
|
println!(
|
|
|
|
"{} {}MB / {}MB",
|
|
|
|
"{} {}MiB / {}MiB",
|
|
|
|
"MEMORY".cyan().bold(),
|
|
|
|
bytes_to_mega_bytes(sys.used_memory()),
|
|
|
|
bytes_to_mega_bytes(sys.total_memory())
|
|
|
|
bytes_to_mebi_bytes(sys.used_memory()),
|
|
|
|
bytes_to_mebi_bytes(sys.total_memory())
|
|
|
|
);
|
|
|
|
|
|
|
|
Ok(())
|
|
|
@ -53,7 +53,7 @@ fn format_uptime(uptime: u64) -> String { |
|
|
|
format!("{:.0}h {:.0}m {:.0}s", h, m, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bytes_to_mega_bytes(bytes: u64) -> u64 {
|
|
|
|
fn bytes_to_mebi_bytes(bytes: u64) -> u64 {
|
|
|
|
bytes / 1024 / 1024
|
|
|
|
}
|
|
|
|
|
|
|
|