diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2021-05-15 18:57:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-15 21:57:02 -0400 |
commit | 6847f2ff0ce5827c0779a1dfcb9e6a8a657652b1 (patch) | |
tree | 2b957d6701f06720baf2cab836303400f340e6f2 /src/app/data_harvester.rs | |
parent | 39c5ee991e8a02a72da398433c62f4a1b8c7acbb (diff) |
refactor: split up data collection by OS (#482)
Refactor to split up data collection by OS and/or the backing library. The goal is to make it easier to work with and add new OS support, as opposed to how it was prior where we stored OS-independent implementations all in the same file.
Diffstat (limited to 'src/app/data_harvester.rs')
-rw-r--r-- | src/app/data_harvester.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs index 60ff5a2a..feab6005 100644 --- a/src/app/data_harvester.rs +++ b/src/app/data_harvester.rs @@ -19,8 +19,7 @@ use super::DataFilters; pub mod batteries; pub mod cpu; pub mod disks; -pub mod load_avg; -pub mod mem; +pub mod memory; pub mod network; pub mod processes; pub mod temperature; @@ -29,9 +28,9 @@ pub mod temperature; pub struct Data { pub last_collection_time: Instant, pub cpu: Option<cpu::CpuHarvest>, - pub load_avg: Option<load_avg::LoadAvgHarvest>, - pub memory: Option<mem::MemHarvest>, - pub swap: Option<mem::MemHarvest>, + pub load_avg: Option<cpu::LoadAvgHarvest>, + pub memory: Option<memory::MemHarvest>, + pub swap: Option<memory::MemHarvest>, pub temperature_sensors: Option<Vec<temperature::TempHarvest>>, pub network: Option<network::NetworkHarvest>, pub list_of_processes: Option<Vec<processes::ProcessHarvest>>, @@ -232,7 +231,7 @@ impl DataCollector { #[cfg(target_family = "unix")] { // Load Average - if let Ok(load_avg_data) = load_avg::get_load_avg().await { + if let Ok(load_avg_data) = cpu::get_load_avg().await { self.data.load_avg = Some(load_avg_data); } } @@ -299,7 +298,7 @@ impl DataCollector { ) } }; - let mem_data_fut = mem::get_mem_data(self.widgets_to_harvest.use_mem); + let mem_data_fut = memory::get_mem_data(self.widgets_to_harvest.use_mem); let disk_data_fut = disks::get_disk_usage( self.widgets_to_harvest.use_disk, &self.filters.disk_filter, |