diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-12-17 15:42:08 -0800 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-12-17 18:42:30 -0500 |
commit | 88366b37140656f6b6e5364db296fc3b37641fc4 (patch) | |
tree | ba2d8a1e3bc5b3b3c1b1685e4f039ccfd4a42c60 /src/app/data_harvester.rs | |
parent | b05efd0d55bb959b05410f827394a322f5037caa (diff) |
uptick: 0.5.6 (#362)0.5.6
(cherry picked from commit bfdaa09e3a397df08ff45c44022537195bab0c2b)
Diffstat (limited to 'src/app/data_harvester.rs')
-rw-r--r-- | src/app/data_harvester.rs | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs index 3644654f..cff9bc2e 100644 --- a/src/app/data_harvester.rs +++ b/src/app/data_harvester.rs @@ -135,6 +135,11 @@ impl DataCollector { self.sys.refresh_components_list(); } + // Refresh network list once... + if cfg!(target_os = "windows") && self.widgets_to_harvest.use_net { + self.sys.refresh_networks_list(); + } + if self.widgets_to_harvest.use_battery { // trace!("First run battery vec creation."); if let Ok(battery_manager) = Manager::new() { @@ -188,6 +193,9 @@ impl DataCollector { self.sys.refresh_components(); } } + if cfg!(target_os = "windows") && self.widgets_to_harvest.use_net { + self.sys.refresh_networks(); + } let current_instant = std::time::Instant::now(); @@ -233,15 +241,28 @@ impl DataCollector { } } - // I am *well* aware that the sysinfo part w/ blocking code is... not great. let network_data_fut = { - network::get_network_data( - self.last_collection_time, - &mut self.total_rx, - &mut self.total_tx, - current_instant, - self.widgets_to_harvest.use_net, - ) + #[cfg(target_os = "windows")] + { + network::get_network_data( + &self.sys, + self.last_collection_time, + &mut self.total_rx, + &mut self.total_tx, + current_instant, + self.widgets_to_harvest.use_net, + ) + } + #[cfg(not(target_os = "windows"))] + { + network::get_network_data( + self.last_collection_time, + &mut self.total_rx, + &mut self.total_tx, + current_instant, + self.widgets_to_harvest.use_net, + ) + } }; let mem_data_fut = mem::get_mem_data(self.widgets_to_harvest.use_mem); let disk_data_fut = disks::get_disk_usage(self.widgets_to_harvest.use_disk); |