Debian Codegraph @

src/collection/nvidia.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#, syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#};
2
3 use nvml_wrapperrust-analyzer cargo nvml-wrapper 0.12.1 crate/::{
4 Nvmlrust-analyzer cargo nvml-wrapper 0.12.1 Nvml#, enum_wrappersrust-analyzer cargo nvml-wrapper 0.12.1 enum_wrappers/::devicerust-analyzer cargo nvml-wrapper 0.12.1 enum_wrappers/device/::TemperatureSensorrust-analyzer cargo nvml-wrapper 0.12.1 enum_wrappers/device/TemperatureSensor#, enumsrust-analyzer cargo nvml-wrapper 0.12.1 enums/::devicerust-analyzer cargo nvml-wrapper 0.12.1 enums/device/::UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#, errorrust-analyzer cargo nvml-wrapper 0.12.1 error/::NvmlErrorrust-analyzer cargo nvml-wrapper 0.12.1 error/NvmlError#,
5 };
6
7 use craterust-analyzer cargo bottom 0.14.9 crate/::{
8 apprust-analyzer cargo bottom 0.14.9 app/::{filterrust-analyzer cargo bottom 0.14.9 app/filter/::Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#, layout_managerrust-analyzer cargo bottom 0.14.9 app/layout_manager/::UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#},
9 collectionrust-analyzer cargo bottom 0.14.9 collection/::{memoryrust-analyzer cargo bottom 0.14.9 collection/memory/::MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#, processesrust-analyzer cargo bottom 0.14.9 collection/processes/::Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, temperaturerust-analyzer cargo bottom 0.14.9 collection/temperature/::TempSensorDatarust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#},
10 utilsrust-analyzer cargo bottom 0.14.9 utils/::int_hashrust-analyzer cargo bottom 0.14.9 utils/int_hash/::IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#,
11 };
12
13 pub static NVML_DATArust-analyzer cargo bottom 0.14.9 collection/nvidia/NVML_DATA.: OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Nvmlrust-analyzer cargo nvml-wrapper 0.12.1 Nvml#, NvmlErrorrust-analyzer cargo nvml-wrapper 0.12.1 error/NvmlError#>> = OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]new().();
14
15 pub struct GpusDatarust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData# {
16 pub memoryrust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#memory.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#)>>,
17 pub temperaturerust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#temperature.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<TempSensorDatarust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#>>,
18 pub procsrust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#procs.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(u64, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, (u64, u32)>>)>,
19 }
20
21 /// Wrapper around Nvml::init
22 ///
23 /// On Linux, if `Nvml::init()` fails, this function attempts to explicitly load
24 /// the library from `libnvidia-ml.so.1`. On other platforms, it simply calls
25 /// `Nvml::init`.
26 ///
27 /// This is a workaround until https://github.com/Cldfire/nvml-wrapper/pull/63 is accepted.
28 /// Then, we can go back to calling `Nvml::init` directly on all platforms.
29 fn init_nvmlrust-analyzer cargo bottom 0.14.9 collection/nvidia/init_nvml().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Nvmlrust-analyzer cargo nvml-wrapper 0.12.1 Nvml#, NvmlErrorrust-analyzer cargo nvml-wrapper 0.12.1 error/NvmlError#> {
30 #[cfg(not(target_os = "linux"))]
31 {
32 Nvmlrust-analyzer cargo nvml-wrapper 0.12.1 Nvml#::init()
33 }
34 #[cfg(target_os = "linux")]
35 {
36 match Nvmlrust-analyzer cargo nvml-wrapper 0.12.1 Nvml#::initrust-analyzer cargo nvml-wrapper 0.12.1 impl#[Nvml]init().() {
37 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(nvml) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(nvml),
38 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => Nvmlrust-analyzer cargo nvml-wrapper 0.12.1 Nvml#::builderrust-analyzer cargo nvml-wrapper 0.12.1 impl#[Nvml]builder().()
39 .lib_pathrust-analyzer cargo nvml-wrapper 0.12.1 impl#[`NvmlBuilder<'a>`]lib_path().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("libnvidia-ml.so.1"))
40 .initrust-analyzer cargo nvml-wrapper 0.12.1 impl#[`NvmlBuilder<'a>`]init().(),
41 }
42 }
43 }
44
45 /// Returns the GPU data from NVIDIA cards.
46 #[inline]
47 pub fn get_nvidia_vecsrust-analyzer cargo bottom 0.14.9 collection/nvidia/get_nvidia_vecs().(
48 filter: &Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#>, graph_filter: &Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#>, widgets_to_harvest: &UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#,
49 ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<GpusDatarust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#> {
50 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(nvml) = NVML_DATArust-analyzer cargo bottom 0.14.9 collection/nvidia/NVML_DATA..get_or_initrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]get_or_init().(init_nvmlrust-analyzer cargo bottom 0.14.9 collection/nvidia/init_nvml().) {
51 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(num_gpu) = nvml.device_countrust-analyzer cargo nvml-wrapper 0.12.1 impl#[Nvml]device_count().() {
52 let mut temp_vec = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(num_gpu as usize);
53 let mut mem_vec = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(num_gpu as usize);
54 let mut proc_vec = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(num_gpu as usize);
55 let mut total_mem = 0;
56
57 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#num_gpu {
58 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(device) = nvml.device_by_indexrust-analyzer cargo nvml-wrapper 0.12.1 impl#[Nvml]device_by_index().(i) {
59 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(name) = device.namerust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]name().() {
60 if widgets_to_harvest.use_memrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_mem.
61 && let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mem) = device.memory_inforust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]memory_info().()
62 && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(total_bytes) = NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(mem.totalrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/MemoryInfo#total.)
63 {
64 mem_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((
65 name.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(),
66 MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData# {
67 total_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#total_bytes.,
68 used_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#used_bytes.: mem.usedrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/MemoryInfo#used.,
69 },
70 ));
71 }
72
73 if (widgets_to_harvest.use_temprust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_temp. || widgets_to_harvest.use_temp_graphrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_temp_graph.)
74 && (Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#::optional_should_keeprust-analyzer cargo bottom 0.14.9 app/filter/impl#[Filter]optional_should_keep().(filter, &name)
75 || Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#::optional_should_keeprust-analyzer cargo bottom 0.14.9 app/filter/impl#[Filter]optional_should_keep().(graph_filter, &name))
76 {
77 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(temperature) = device.temperaturerust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]temperature().(TemperatureSensorrust-analyzer cargo nvml-wrapper 0.12.1 enum_wrappers/device/TemperatureSensor#::Gpurust-analyzer cargo nvml-wrapper 0.12.1 enum_wrappers/device/TemperatureSensor#Gpu#) {
78 temp_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TempSensorDatarust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData# {
79 namerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#name.,
80 temperaturerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#temperature.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(temperature as f32),
81 });
82 } else {
83 temp_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TempSensorDatarust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData# {
84 namerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#name.,
85 temperaturerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#temperature.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
86 });
87 }
88 }
89 }
90
91 if widgets_to_harvest.use_procrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_proc. {
92 let mut procs = IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().();
93
94 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(gpu_procs) = device.process_utilization_statsrust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]process_utilization_stats().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) {
95 for proc in gpu_procs {
96 let pid = proc.pidrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessUtilizationSample#pid. as Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#;
97 let gpu_util = proc.sm_utilrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessUtilizationSample#sm_util. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().proc.enc_utilrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessUtilizationSample#enc_util. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().proc.dec_utilrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessUtilizationSample#dec_util.;
98 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (0, gpu_util));
99 }
100 }
101
102 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(compute_procs) = device.running_compute_processesrust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]running_compute_processes().() {
103 for proc in compute_procs {
104 let pid = proc.pidrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessInfo#pid. as Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#;
105 let gpu_mem = match proc.used_gpu_memoryrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessInfo#used_gpu_memory. {
106 UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#::Usedrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#Used#(val) => val,
107 UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#::Unavailablerust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#Unavailable# => 0,
108 };
109 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prev) = procs.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&pid) {
110 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (gpu_mem, prev.1));
111 } else {
112 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (gpu_mem, 0));
113 }
114 }
115 }
116
117 // Use the legacy API too but prefer newer API results
118 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(graphics_procs) = device.running_graphics_processes_v2rust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]running_graphics_processes_v2().() {
119 for proc in graphics_procs {
120 let pid = proc.pidrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessInfo#pid. as Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#;
121 let gpu_mem = match proc.used_gpu_memoryrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessInfo#used_gpu_memory. {
122 UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#::Usedrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#Used#(val) => val,
123 UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#::Unavailablerust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#Unavailable# => 0,
124 };
125 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prev) = procs.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&pid) {
126 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (gpu_mem, prev.1));
127 } else {
128 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (gpu_mem, 0));
129 }
130 }
131 }
132
133 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(graphics_procs) = device.running_graphics_processesrust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]running_graphics_processes().() {
134 for proc in graphics_procs {
135 let pid = proc.pidrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessInfo#pid. as Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#;
136 let gpu_mem = match proc.used_gpu_memoryrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/ProcessInfo#used_gpu_memory. {
137 UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#::Usedrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#Used#(val) => val,
138 UsedGpuMemoryrust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#::Unavailablerust-analyzer cargo nvml-wrapper 0.12.1 enums/device/UsedGpuMemory#Unavailable# => 0,
139 };
140 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prev) = procs.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&pid) {
141 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (gpu_mem, prev.1));
142 } else {
143 procs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, (gpu_mem, 0));
144 }
145 }
146 }
147
148 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().procs.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]is_empty().() {
149 proc_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(procs);
150 }
151
152 // running total for proc %
153 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mem) = device.memory_inforust-analyzer cargo nvml-wrapper 0.12.1 device/impl#[`Device<'nvml>`]memory_info().() {
154 total_mem rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().mem.totalrust-analyzer cargo nvml-wrapper 0.12.1 struct_wrappers/device/MemoryInfo#total.;
155 }
156 }
157 }
158 }
159
160 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GpusDatarust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData# {
161 memoryrust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#memory.: if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().mem_vec.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
162 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mem_vec)
163 } else {
164 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
165 },
166 temperaturerust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#temperature.: if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().temp_vec.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
167 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(temp_vec)
168 } else {
169 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
170 },
171 procsrust-analyzer cargo bottom 0.14.9 collection/nvidia/GpusData#procs.: if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().proc_vec.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
172 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((total_mem, proc_vec))
173 } else {
174 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
175 },
176 })
177 } else {
178 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
179 }
180 } else {
181 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
182 }
183 }