Added RAM usage bars

This commit is contained in:
2024-05-27 17:53:41 +01:00
parent 584c0d3be8
commit e0b8b15849
2 changed files with 20 additions and 10 deletions

View File

@@ -35,10 +35,14 @@ struct DiskInfo {
#[derive(Serialize, Debug)]
struct RamInfo {
total_memory: String,
used_memory: String,
total_swap: String,
used_swap: String,
total_memory: u64,
used_memory: u64,
total_swap: u64,
used_swap: u64,
total_memory_pretty: String,
used_memory_pretty: String,
total_swap_pretty: String,
used_swap_pretty: String,
}
#[derive(Serialize, Debug)]
@@ -118,10 +122,14 @@ fn get_system_info(network_if_names: &Vec<String>) -> SysInfo {
disks: disks_context,
components: components_context,
ram: RamInfo {
total_memory: Byte::from(sys.total_memory()).to_string(),
used_memory: Byte::from(sys.used_memory()).to_string(),
total_swap: Byte::from(sys.total_swap()).to_string(),
used_swap: Byte::from(sys.used_swap()).to_string(),
total_memory: sys.total_memory(),
used_memory: sys.used_memory(),
total_swap: sys.total_swap(),
used_swap: sys.used_swap(),
total_memory_pretty: Byte::from(sys.total_memory()).to_string(),
used_memory_pretty: Byte::from(sys.used_memory()).to_string(),
total_swap_pretty: Byte::from(sys.total_swap()).to_string(),
used_swap_pretty: Byte::from(sys.used_swap()).to_string(),
},
network_ifs: network_ifs,
network_ifs_errored: network_ifs_errored,