diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app/data_harvester/memory/general/heim.rs | 2 | ||||
-rw-r--r-- | src/app/data_harvester/nvidia.rs | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/app/data_harvester/memory/general/heim.rs b/src/app/data_harvester/memory/general/heim.rs index bb63d2b5..27221420 100644 --- a/src/app/data_harvester/memory/general/heim.rs +++ b/src/app/data_harvester/memory/general/heim.rs @@ -257,9 +257,11 @@ pub async fn get_arc_data() -> crate::utils::error::Result<Option<MemHarvest>> { })) } +// FIXME: Can unify this with the sysinfo impl #[cfg(feature = "nvidia")] pub async fn get_gpu_data() -> crate::utils::error::Result<Option<Vec<(String, MemHarvest)>>> { use crate::data_harvester::nvidia::NVML_DATA; + if let Ok(nvml) = &*NVML_DATA { if let Ok(ngpu) = nvml.device_count() { let mut results = Vec::with_capacity(ngpu as usize); diff --git a/src/app/data_harvester/nvidia.rs b/src/app/data_harvester/nvidia.rs index 2cb4b622..9619da64 100644 --- a/src/app/data_harvester/nvidia.rs +++ b/src/app/data_harvester/nvidia.rs @@ -1,3 +1,4 @@ use nvml_wrapper::{error::NvmlError, Nvml}; use once_cell::sync::Lazy; + pub static NVML_DATA: Lazy<Result<Nvml, NvmlError>> = Lazy::new(Nvml::init); |