Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi committed Dec 5, 2024
1 parent 3d3f103 commit 2d2e439
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/sysinfo_instance.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sysinfo::{CpuRefreshKind, Disks, MemoryRefreshKind, RefreshKind, System};
use sysinfo::{CpuRefreshKind, DiskRefreshKind, Disks, MemoryRefreshKind, RefreshKind, System};

pub struct SysinfoInstance {
pub system: System,
Expand All @@ -8,20 +8,22 @@ pub struct SysinfoInstance {
impl SysinfoInstance {
pub fn new() -> SysinfoInstance {
let system = System::new_with_specifics(
RefreshKind::new()
.with_cpu(CpuRefreshKind::new().with_cpu_usage())
RefreshKind::nothing()
.with_cpu(CpuRefreshKind::nothing().with_cpu_usage())
.with_memory(MemoryRefreshKind::everything()),
);
let disks = Disks::new_with_refreshed_list();
let disks =
Disks::new_with_refreshed_list_specifics(DiskRefreshKind::nothing().with_storage());

SysinfoInstance { system, disks }
}
pub fn refresh(&mut self) {
self.system.refresh_specifics(
RefreshKind::new()
.with_cpu(CpuRefreshKind::new().with_cpu_usage())
RefreshKind::nothing()
.with_cpu(CpuRefreshKind::nothing().with_cpu_usage())
.with_memory(MemoryRefreshKind::everything()),
);
self.disks.refresh_list();
self.disks
.refresh_specifics(true, DiskRefreshKind::nothing().with_storage());
}
}

0 comments on commit 2d2e439

Please sign in to comment.