compact disk information+
This commit is contained in:
@@ -50,23 +50,19 @@ pub fn get_disk_utitlization() -> Result<(f64, f64, f64, f64), Box<dyn Error>> {
|
|||||||
|
|
||||||
let disks = Disks::new_with_refreshed_list();
|
let disks = Disks::new_with_refreshed_list();
|
||||||
for disk in disks.list() {
|
for disk in disks.list() {
|
||||||
// Ignoriere kleine Systempartitionen
|
// Only print disks with known kind
|
||||||
|
if disk.kind() == sysinfo::DiskKind::Unknown(0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
println!(
|
println!(
|
||||||
"Disk_Name: {:?}, Disk_Kind: {}, Total: {}, Available: {}",
|
"Disk_Name: {:?}:\n---- Disk_Kind: {},\n---- Total: {},\n---- Available: {},\n---- Used: {}, \n---- Mount_Point: {:?}",
|
||||||
disk.name(),
|
disk.name(),
|
||||||
disk.kind(),
|
disk.kind(),
|
||||||
disk.total_space(),
|
disk.total_space(),
|
||||||
disk.available_space(),
|
disk.available_space(),
|
||||||
|
disk.total_space() - disk.available_space(),
|
||||||
|
disk.mount_point()
|
||||||
);
|
);
|
||||||
println!("[{:?}] {:?}", disk.name(), disk.mount_point());
|
|
||||||
if disk.total_space() > 100 * 1024 * 1024 {
|
|
||||||
// > 100MB
|
|
||||||
total_size += disk.total_space();
|
|
||||||
total_available += disk.available_space();
|
|
||||||
total_used += disk.total_space() - disk.available_space();
|
|
||||||
count += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let components = Components::new_with_refreshed_list();
|
let components = Components::new_with_refreshed_list();
|
||||||
for component in &components {
|
for component in &components {
|
||||||
|
Reference in New Issue
Block a user