diff --git a/src/ui/pages/drive.rs b/src/ui/pages/drive.rs index 4971d43..a8c6df3 100644 --- a/src/ui/pages/drive.rs +++ b/src/ui/pages/drive.rs @@ -263,12 +263,6 @@ impl ResDrive { imp.set_tab_detail_string(&drive_data.inner.block_device); } - if let Ok(link) = drive.link() { - imp.link.set_subtitle(&link.to_string()); - } else { - imp.link.set_subtitle(&i18n("N/A")); - } - imp.old_stats .borrow_mut() .clone_from(&drive_data.disk_stats); @@ -289,6 +283,7 @@ impl ResDrive { removable, disk_stats, capacity, + link, } = drive_data; let time_passed = SystemTime::now() @@ -428,6 +423,12 @@ impl ResDrive { imp.removable.set_subtitle(&i18n("N/A")); } + if let Ok(link) = link { + imp.link.set_subtitle(&link.to_string()); + } else { + imp.link.set_subtitle(&i18n("N/A")); + } + self.set_property( "tab_usage_string", // Translators: This is an abbreviation for "Read" and "Write". This is displayed in the sidebar so your diff --git a/src/ui/pages/gpu.rs b/src/ui/pages/gpu.rs index 0958bde..b70b81e 100644 --- a/src/ui/pages/gpu.rs +++ b/src/ui/pages/gpu.rs @@ -260,12 +260,6 @@ impl ResGPU { imp.encode_decode_usage.set_visible(true); } - if let Ok(link) = gpu.link() { - imp.link.set_subtitle(&link.to_string()); - } else { - imp.link.set_subtitle(&i18n("N/A")); - } - if let Ok(model_name) = gpu.name() { imp.set_tab_detail_string(&model_name); } @@ -293,6 +287,7 @@ impl ResGPU { power_usage, power_cap, power_cap_max, + link, nvidia: _, } = gpu_data; @@ -435,6 +430,12 @@ impl ResGPU { imp.temperature.set_subtitle(&i18n("N/A")); } + if let Some(link) = link { + imp.link.set_subtitle(&link.to_string()); + } else { + imp.link.set_subtitle(&i18n("N/A")); + } + self.set_property("tab_usage_string", &usage_percentage_string); } } diff --git a/src/ui/pages/npu.rs b/src/ui/pages/npu.rs index 2570e13..96ecdc3 100644 --- a/src/ui/pages/npu.rs +++ b/src/ui/pages/npu.rs @@ -221,12 +221,6 @@ impl ResNPU { imp.driver_used.set_subtitle(&npu.driver()); - if let Ok(link) = npu.link() { - imp.link.set_subtitle(&link.to_string()); - } else { - imp.link.set_subtitle(&i18n("N/A")); - } - if let Ok(model_name) = npu.name() { imp.set_tab_detail_string(&model_name); } @@ -252,6 +246,7 @@ impl ResNPU { power_usage, power_cap, power_cap_max, + link, } = npu_data; let mut usage_percentage_string = usage_fraction.map_or_else( @@ -366,6 +361,12 @@ impl ResNPU { imp.temperature.set_subtitle(&i18n("N/A")); } + if let Some(link) = link { + imp.link.set_subtitle(&link.to_string()); + } else { + imp.link.set_subtitle(&i18n("N/A")); + } + self.set_property("tab_usage_string", &usage_percentage_string); } } diff --git a/src/utils/drive.rs b/src/utils/drive.rs index f7d31ac..72427b8 100644 --- a/src/utils/drive.rs +++ b/src/utils/drive.rs @@ -34,6 +34,7 @@ pub struct DriveData { pub removable: Result, pub disk_stats: HashMap, pub capacity: Result, + pub link: Result, } impl DriveData { @@ -48,6 +49,7 @@ impl DriveData { let removable = inner.removable(); let disk_stats = inner.sys_stats().unwrap_or_default(); let capacity = inner.capacity(); + let link = inner.link(); let drive_data = Self { inner, @@ -56,6 +58,7 @@ impl DriveData { removable, disk_stats, capacity, + link, }; trace!( diff --git a/src/utils/gpu/mod.rs b/src/utils/gpu/mod.rs index b8ee53f..8f7fffc 100644 --- a/src/utils/gpu/mod.rs +++ b/src/utils/gpu/mod.rs @@ -53,6 +53,8 @@ pub struct GpuData { pub power_cap: Option, pub power_cap_max: Option, + pub link: Option, + pub nvidia: bool, } @@ -80,6 +82,8 @@ impl GpuData { let power_cap = gpu.power_cap().ok(); let power_cap_max = gpu.power_cap_max().ok(); + let link = gpu.link().ok(); + let nvidia = matches!(gpu, Gpu::Nvidia(_)); let gpu_data = Self { @@ -95,6 +99,7 @@ impl GpuData { power_usage, power_cap, power_cap_max, + link, nvidia, }; diff --git a/src/utils/npu/mod.rs b/src/utils/npu/mod.rs index 74113c5..0eefe37 100644 --- a/src/utils/npu/mod.rs +++ b/src/utils/npu/mod.rs @@ -43,6 +43,8 @@ pub struct NpuData { pub power_usage: Option, pub power_cap: Option, pub power_cap_max: Option, + + pub link: Option, } impl NpuData { @@ -65,6 +67,8 @@ impl NpuData { let power_cap = npu.power_cap().ok(); let power_cap_max = npu.power_cap_max().ok(); + let link = npu.link().ok(); + let npu_data = Self { pci_slot, usage_fraction, @@ -76,6 +80,7 @@ impl NpuData { power_usage, power_cap, power_cap_max, + link, }; trace!("Gathered NPU data for {}: {npu_data:?}", pci_slot);