| 1 | mod amd_gpu_marketingrust-analyzer cargo bottom 0.14.9 collection/amd/amd_gpu_marketing/; |
| 2 | |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{ |
| 4 | cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#, |
| 5 | fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/, read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().}, |
| 6 | 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#, |
| 7 | pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}, |
| 8 | timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::{Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#, Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#}, |
| 9 | }; |
| 10 | |
| 11 | use rustc_hashrust-analyzer cargo rustc-hash 2.1.3 crate/::{FxHashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap# as HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#, FxHashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet# as HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#}; |
| 12 | |
| 13 | use superrust-analyzer cargo bottom 0.14.9 collection/::linuxrust-analyzer cargo bottom 0.14.9 collection/linux/::utilsrust-analyzer cargo bottom 0.14.9 collection/linux/utils/::is_device_awakerust-analyzer cargo bottom 0.14.9 collection/linux/utils/is_device_awake().; |
| 14 | use craterust-analyzer cargo bottom 0.14.9 crate/::{ |
| 15 | apprust-analyzer cargo bottom 0.14.9 app/::layout_managerrust-analyzer cargo bottom 0.14.9 app/layout_manager/::UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#, |
| 16 | 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#}, |
| 17 | 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#, IntHashSetrust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashSet#}, |
| 18 | }; |
| 19 | |
| 20 | // TODO: May be able to clean up some of these, Option<Vec> for example is a bit |
| 21 | // redundant. |
| 22 | pub struct AmdGpuDatarust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData# { |
| 23 | pub memoryrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData#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#)>>, |
| 24 | pub procsrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData#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)>>)>, |
| 25 | } |
| 26 | |
| 27 | pub struct AmdGpuMemoryrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory# { |
| 28 | pub totalrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory#total.: u64, |
| 29 | pub usedrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory#used.: u64, |
| 30 | } |
| 31 | |
| 32 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 33 | pub struct AmdGpuProcrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc# { |
| 34 | pub vram_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vram_usage.: u64, |
| 35 | pub gfx_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#gfx_usage.: u64, |
| 36 | pub dma_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dma_usage.: u64, |
| 37 | pub enc_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#enc_usage.: u64, |
| 38 | pub dec_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dec_usage.: u64, |
| 39 | pub uvd_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#uvd_usage.: u64, |
| 40 | pub vcn_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vcn_usage.: u64, |
| 41 | pub vpe_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vpe_usage.: u64, |
| 42 | pub compute_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#compute_usage.: u64, |
| 43 | } |
| 44 | |
| 45 | // TODO: This is kind of a hack. |
| 46 | thread_localrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/thread_local!! { |
| 47 | static PREV_PROC_DATArust-analyzer cargo bottom 0.14.9 collection/amd/PREV_PROC_DATA.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, AmdGpuProcrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#>>> = RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]new().(HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().()); |
| 48 | static LAST_CLEAN_COUNTERrust-analyzer cargo bottom 0.14.9 collection/amd/LAST_CLEAN_COUNTER.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<u32> = const { RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]new().(0) }; |
| 49 | } |
| 50 | |
| 51 | fn get_amd_devsrust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_devs().() -> 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#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>> { |
| 52 | let mut devices = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 53 | |
| 54 | // read all PCI devices controlled by the AMDGPU module |
| 55 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(paths) = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().("/sys/module/amdgpu/drivers/pci:amdgpu") else { |
| 56 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 57 | }; |
| 58 | |
| 59 | for path in paths { |
| 60 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(path) = path else { continue }; |
| 61 | |
| 62 | // test if it has a valid vendor path |
| 63 | let device_path = path.pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().(); |
| 64 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().device_path.is_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]is_dir().() { |
| 65 | continue; |
| 66 | } |
| 67 | |
| 68 | // Skip if asleep to avoid wakeups. |
| 69 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_device_awakerust-analyzer cargo bottom 0.14.9 collection/linux/utils/is_device_awake().(&device_path) { |
| 70 | continue; |
| 71 | } |
| 72 | |
| 73 | // This will exist for GPUs but not others, this is how we find their kernel |
| 74 | // name. |
| 75 | let test_path = device_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("drm"); |
| 76 | if test_path.as_pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]as_path().().existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() { |
| 77 | devices.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(device_path); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | if devices.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 82 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 83 | } else { |
| 84 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devices) |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | pub fn get_amd_namerust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_name().(device_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 89 | // get revision and device ids from sysfs |
| 90 | let rev_path = device_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("revision"); |
| 91 | let dev_path = device_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("device"); |
| 92 | |
| 93 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rev_path.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dev_path.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() { |
| 94 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 95 | } |
| 96 | |
| 97 | // read and remove newlines, 0x0 suffix. |
| 98 | let mut rev_data = read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(rev_path).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().("0x00".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 99 | let mut dev_data = read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(dev_path).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().("0x0000".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 100 | |
| 101 | rev_data = rev_data.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 102 | dev_data = dev_data.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 103 | |
| 104 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(stripped) = rev_data.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("0x") { |
| 105 | rev_data = stripped.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 106 | } |
| 107 | |
| 108 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(stripped) = dev_data.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("0x") { |
| 109 | dev_data = stripped.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 110 | } |
| 111 | |
| 112 | let revision_id = u32::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_str_radix().(&rev_data, 16).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0); |
| 113 | let device_id = u32::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_str_radix().(&dev_data, 16).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0); |
| 114 | |
| 115 | if device_id rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().0 { |
| 116 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 117 | } |
| 118 | |
| 119 | // if it exists in our local database, use that name |
| 120 | amd_gpu_marketingrust-analyzer cargo bottom 0.14.9 collection/amd/amd_gpu_marketing/::AMD_GPU_MARKETING_NAMErust-analyzer cargo bottom 0.14.9 collection/amd/amd_gpu_marketing/AMD_GPU_MARKETING_NAME. |
| 121 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 122 | .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find().(|(did, rid, _)| (did, rid) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(U, T)`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(U, T)`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(U, T)`][`PartialEq<Self>`]eq().(&device_id, &revision_id)) |
| 123 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|tuple| tuple.2.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 124 | } |
| 125 | |
| 126 | fn get_amd_vramrust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_vram().(device_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<AmdGpuMemoryrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory#> { |
| 127 | // get vram memory info from sysfs |
| 128 | let vram_total_path = device_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("mem_info_vram_total"); |
| 129 | let vram_used_path = device_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("mem_info_vram_used"); |
| 130 | |
| 131 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mut vram_total_data) = read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(vram_total_path) else { |
| 132 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 133 | }; |
| 134 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mut vram_used_data) = read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(vram_used_path) else { |
| 135 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 136 | }; |
| 137 | |
| 138 | // read and remove newlines |
| 139 | vram_total_data = vram_total_data.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 140 | vram_used_data = vram_used_data.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 141 | |
| 142 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(vram_total) = vram_total_data.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u64>() else { |
| 143 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 144 | }; |
| 145 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(vram_used) = vram_used_data.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u64>() else { |
| 146 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 147 | }; |
| 148 | |
| 149 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(AmdGpuMemoryrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory# { |
| 150 | totalrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory#total.: vram_total, |
| 151 | usedrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory#used.: vram_used, |
| 152 | }) |
| 153 | } |
| 154 | |
| 155 | // from amdgpu_top: https://github.com/Umio-Yasuno/amdgpu_top/blob/c961cf6625c4b6d63fda7f03348323048563c584/crates/libamdgpu_top/src/stat/fdinfo/proc_info.rs#L114 |
| 156 | fn diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(pre: u64, cur: u64, interval: &Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#) -> u64 { |
| 157 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#; |
| 158 | |
| 159 | let diff_ns = if pre rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().0 || cur rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]lt().pre { |
| 160 | return 0; |
| 161 | } else { |
| 162 | cur.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_sub().(pre) as u128 |
| 163 | }; |
| 164 | |
| 165 | diff_ns |
| 166 | .mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Mul<Self>`]mul().(100) |
| 167 | .checked_divrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u128]checked_div().(interval.as_nanosrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_nanos().()) |
| 168 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0) as u64 |
| 169 | } |
| 170 | |
| 171 | // from amdgpu_top: https://github.com/Umio-Yasuno/amdgpu_top/blob/c961cf6625c4b6d63fda7f03348323048563c584/crates/libamdgpu_top/src/stat/fdinfo/proc_info.rs#L13-L27 |
| 172 | fn get_amdgpu_pid_fdsrust-analyzer cargo bottom 0.14.9 collection/amd/get_amdgpu_pid_fds().(pid: Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, device_path: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>) -> 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#<u32>> { |
| 173 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(fd_list) = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/proc/{pid}/fd/")) else { |
| 174 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 175 | }; |
| 176 | |
| 177 | let valid_fds: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32> = fd_list |
| 178 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|fd_link| { |
| 179 | let dir_entry = fd_link.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|fd_link| fd_link.pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 180 | let link = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_linkrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_link().(&dir_entry).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 181 | |
| 182 | // e.g. "/dev/dri/renderD128" or "/dev/dri/card0" |
| 183 | if device_path.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|path| link.starts_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]starts_with().(path)) { |
| 184 | dir_entry.file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_str().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() |
| 185 | } else { |
| 186 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 187 | } |
| 188 | }) |
| 189 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 190 | |
| 191 | if valid_fds.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 192 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 193 | } else { |
| 194 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(valid_fds) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | fn get_amdgpu_drmrust-analyzer cargo bottom 0.14.9 collection/amd/get_amdgpu_drm().(device_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> 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#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>> { |
| 199 | let mut drm_devices = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 200 | let drm_root = device_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("drm"); |
| 201 | |
| 202 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(drm_paths) = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().(drm_root) else { |
| 203 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 204 | }; |
| 205 | |
| 206 | for drm_dir in drm_paths { |
| 207 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(drm_dir) = drm_dir else { |
| 208 | continue; |
| 209 | }; |
| 210 | |
| 211 | // attempt to get the device renderer name |
| 212 | let drm_name = drm_dir.file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().(); |
| 213 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(drm_name) = drm_name.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_str().() else { |
| 214 | continue; |
| 215 | }; |
| 216 | |
| 217 | // construct driver device path if valid |
| 218 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().drm_name.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("card") && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().drm_name.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("render") { |
| 219 | continue; |
| 220 | } |
| 221 | |
| 222 | drm_devices.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<String>`]from().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/dev/dri/{drm_name}"))); |
| 223 | } |
| 224 | |
| 225 | if drm_devices.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 226 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 227 | } else { |
| 228 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(drm_devices) |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | fn get_amd_fdinforust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_fdinfo().(device_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, AmdGpuProcrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#>> { |
| 233 | let mut fdinfo = 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().(); |
| 234 | |
| 235 | let drm_paths = get_amdgpu_drmrust-analyzer cargo bottom 0.14.9 collection/amd/get_amdgpu_drm().(device_path)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 236 | |
| 237 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(proc_dir) = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().("/proc") else { |
| 238 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 239 | }; |
| 240 | |
| 241 | let pids: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#> = proc_dir |
| 242 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|dir_entry| { |
| 243 | // check if pid is valid |
| 244 | let dir_entry = dir_entry.okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 245 | let metadata = dir_entry.metadatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]metadata().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 246 | |
| 247 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().metadata.is_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[Metadata]is_dir().() { |
| 248 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 249 | } |
| 250 | |
| 251 | let pid = dir_entry.file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().().to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_str().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 252 | |
| 253 | // skip init process |
| 254 | if pid rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().1 { |
| 255 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 256 | } |
| 257 | |
| 258 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pid) |
| 259 | }) |
| 260 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 261 | |
| 262 | for pid in pids { |
| 263 | // collect file descriptors that point to our device renderers |
| 264 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fds) = get_amdgpu_pid_fdsrust-analyzer cargo bottom 0.14.9 collection/amd/get_amdgpu_pid_fds().(pid, drm_paths.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().()) else { |
| 265 | continue; |
| 266 | }; |
| 267 | |
| 268 | let mut usage: AmdGpuProcrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc# = Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 collection/amd/impl#[AmdGpuProc][Default]default().(); |
| 269 | |
| 270 | let mut observed_ids: HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#<usize> = HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S>`][Default]default().(); |
| 271 | |
| 272 | for fd in fds { |
| 273 | let fdinfo_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/proc/{pid}/fdinfo/{fd}"); |
| 274 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(fdinfo_data) = read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(fdinfo_path) else { |
| 275 | continue; |
| 276 | }; |
| 277 | |
| 278 | let mut fdinfo_lines = fdinfo_data |
| 279 | .linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().() |
| 280 | .skip_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip_while().(|l| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().l.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("drm-client-id")); |
| 281 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id) = fdinfo_lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip_while/impl#[`SkipWhile<I, P>`][Iterator]next().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|fdinfo_line| { |
| 282 | const LENrust-analyzer cargo bottom 0.14.9 collection/amd/LEN.: usize = "drm-client-id:\t".lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(); |
| 283 | fdinfo_line.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(LENrust-analyzer cargo bottom 0.14.9 collection/amd/LEN...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() |
| 284 | }) { |
| 285 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().observed_ids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(id) { |
| 286 | continue; |
| 287 | } |
| 288 | } else { |
| 289 | continue; |
| 290 | } |
| 291 | |
| 292 | for fdinfo_line in fdinfo_lines { |
| 293 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fdinfo_separator_index) = fdinfo_line.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(':') else { |
| 294 | continue; |
| 295 | }; |
| 296 | |
| 297 | let (fdinfo_keyword, mut fdinfo_value) = |
| 298 | fdinfo_line.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_at().(fdinfo_separator_index); |
| 299 | fdinfo_value = &fdinfo_value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 300 | |
| 301 | fdinfo_value = fdinfo_value.trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().(); |
| 302 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fdinfo_value_space_index) = fdinfo_value.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(' ') { |
| 303 | fdinfo_value = &fdinfo_value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#fdinfo_value_space_index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 304 | }; |
| 305 | |
| 306 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(fdinfo_value_num) = fdinfo_value.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u64>() else { |
| 307 | continue; |
| 308 | }; |
| 309 | |
| 310 | match fdinfo_keyword { |
| 311 | "drm-engine-gfx" => usage.gfx_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#gfx_usage. 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().fdinfo_value_num, |
| 312 | "drm-engine-dma" => usage.dma_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dma_usage. 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().fdinfo_value_num, |
| 313 | "drm-engine-dec" => usage.dec_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dec_usage. 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().fdinfo_value_num, |
| 314 | "drm-engine-enc" => usage.enc_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#enc_usage. 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().fdinfo_value_num, |
| 315 | "drm-engine-enc_1" => usage.uvd_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#uvd_usage. 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().fdinfo_value_num, |
| 316 | "drm-engine-jpeg" => usage.vcn_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vcn_usage. 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().fdinfo_value_num, |
| 317 | "drm-engine-vpe" => usage.vpe_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vpe_usage. 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().fdinfo_value_num, |
| 318 | "drm-engine-compute" => usage.compute_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#compute_usage. 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().fdinfo_value_num, |
| 319 | "drm-memory-vram" => usage.vram_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vram_usage. 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().fdinfo_value_num rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl().10, // KiB -> B |
| 320 | _ => {} |
| 321 | }; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | if usage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 collection/amd/impl#[AmdGpuProc][Default]default().() { |
| 326 | fdinfo.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(pid, usage); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fdinfo) |
| 331 | } |
| 332 | |
| 333 | pub fn get_amd_vecsrust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_vecs().(widgets_to_harvest: &UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#, prev_time: Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<AmdGpuDatarust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData#> { |
| 334 | let device_path_list = get_amd_devsrust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_devs().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 335 | let interval = Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]now().().duration_sincerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]duration_since().(prev_time); |
| 336 | let num_gpu = device_path_list.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 337 | 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); |
| 338 | 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); |
| 339 | let mut total_mem = 0; |
| 340 | |
| 341 | PREV_PROC_DATArust-analyzer cargo bottom 0.14.9 collection/amd/PREV_PROC_DATA..with_borrow_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/impl#[`LocalKey<RefCell<T>>`]with_borrow_mut().(|prev_proc_data| { |
| 342 | let device_path_set = device_path_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#<_>>(); |
| 343 | prev_proc_data.retainrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]retain().(|k, _| device_path_set.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(k)); |
| 344 | }); |
| 345 | |
| 346 | for device_path in device_path_list { |
| 347 | let device_name = get_amd_namerust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_name().(&device_path) |
| 348 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(amd_gpu_marketingrust-analyzer cargo bottom 0.14.9 collection/amd/amd_gpu_marketing/::AMDGPU_DEFAULT_NAMErust-analyzer cargo bottom 0.14.9 collection/amd/amd_gpu_marketing/AMDGPU_DEFAULT_NAME..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 349 | |
| 350 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mem) = get_amd_vramrust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_vram().(&device_path) { |
| 351 | if widgets_to_harvest.use_memrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_mem. |
| 352 | && 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 bottom 0.14.9 collection/amd/AmdGpuMemory#total.) |
| 353 | { |
| 354 | mem_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(( |
| 355 | device_name.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), |
| 356 | MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData# { |
| 357 | total_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#total_bytes., |
| 358 | used_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#used_bytes.: mem.usedrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuMemory#used., |
| 359 | }, |
| 360 | )); |
| 361 | } |
| 362 | |
| 363 | 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 bottom 0.14.9 collection/amd/AmdGpuMemory#total. |
| 364 | } |
| 365 | |
| 366 | if widgets_to_harvest.use_procrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_proc. |
| 367 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(procs) = get_amd_fdinforust-analyzer cargo bottom 0.14.9 collection/amd/get_amd_fdinfo().(&device_path) |
| 368 | { |
| 369 | PREV_PROC_DATArust-analyzer cargo bottom 0.14.9 collection/amd/PREV_PROC_DATA..with_borrow_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/impl#[`LocalKey<RefCell<T>>`]with_borrow_mut().(|prev_proc_data| { |
| 370 | let prev_fdinfo = prev_proc_data.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(device_path).or_defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V>`]or_default().(); |
| 371 | let mut seen_pids = IntHashSetrust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashSet#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().(); |
| 372 | |
| 373 | let mut procs_map = 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().(); |
| 374 | for (proc_pid, proc_usage) in procs { |
| 375 | seen_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(proc_pid); |
| 376 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prev_usage) = prev_fdinfo.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(&proc_pid) { |
| 377 | // calculate deltas |
| 378 | let gfx_usage = |
| 379 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.gfx_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#gfx_usage., proc_usage.gfx_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#gfx_usage., &interval); |
| 380 | let dma_usage = |
| 381 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.dma_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dma_usage., proc_usage.dma_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dma_usage., &interval); |
| 382 | let enc_usage = |
| 383 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.enc_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#enc_usage., proc_usage.enc_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#enc_usage., &interval); |
| 384 | let dec_usage = |
| 385 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.dec_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dec_usage., proc_usage.dec_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#dec_usage., &interval); |
| 386 | let uvd_usage = |
| 387 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.uvd_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#uvd_usage., proc_usage.uvd_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#uvd_usage., &interval); |
| 388 | let vcn_usage = |
| 389 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.vcn_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vcn_usage., proc_usage.vcn_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vcn_usage., &interval); |
| 390 | let vpe_usage = |
| 391 | diff_usagerust-analyzer cargo bottom 0.14.9 collection/amd/diff_usage().(prev_usage.vpe_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vpe_usage., proc_usage.vpe_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vpe_usage., &interval); |
| 392 | |
| 393 | // combined usage |
| 394 | let gpu_util_wide = gfx_usage |
| 395 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().dma_usage |
| 396 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().enc_usage |
| 397 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().dec_usage |
| 398 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().uvd_usage |
| 399 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().vcn_usage |
| 400 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().vpe_usage; |
| 401 | |
| 402 | let gpu_util: u32 = gpu_util_wide.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0); |
| 403 | |
| 404 | if gpu_util rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().0 || proc_usage.vram_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vram_usage. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().0 { |
| 405 | procs_map.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(proc_pid, (proc_usage.vram_usagerust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuProc#vram_usage., gpu_util)); |
| 406 | } |
| 407 | |
| 408 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().prev_usage = proc_usage; |
| 409 | } else { |
| 410 | prev_fdinfo.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(proc_pid, proc_usage); |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | prev_fdinfo.retainrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]retain().(|k, _| seen_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(k)); |
| 415 | |
| 416 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().procs_map.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]is_empty().() { |
| 417 | proc_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(procs_map); |
| 418 | } |
| 419 | }); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | // Bit of a hacky way to keep this trimmed. Ain't pretty but it should work. |
| 424 | LAST_CLEAN_COUNTERrust-analyzer cargo bottom 0.14.9 collection/amd/LAST_CLEAN_COUNTER..with_borrow_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/impl#[`LocalKey<RefCell<T>>`]with_borrow_mut().(|counter| { |
| 425 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().counter rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign().1; |
| 426 | |
| 427 | if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().counter rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().300 { |
| 428 | PREV_PROC_DATArust-analyzer cargo bottom 0.14.9 collection/amd/PREV_PROC_DATA..with_borrow_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/impl#[`LocalKey<RefCell<T>>`]with_borrow_mut().(|prev_proc_data| { |
| 429 | for prev_fdinfo in prev_proc_data.values_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values_mut().() { |
| 430 | prev_fdinfo.shrink_to_fitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]shrink_to_fit().(); |
| 431 | } |
| 432 | |
| 433 | prev_proc_data.shrink_to_fitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]shrink_to_fit().(); |
| 434 | }); |
| 435 | |
| 436 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().counter = 0; |
| 437 | } |
| 438 | }); |
| 439 | |
| 440 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(AmdGpuDatarust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData# { |
| 441 | memoryrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData#memory.: (!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().()).then_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core bool/impl#[bool]then_some().(mem_vec), |
| 442 | procsrust-analyzer cargo bottom 0.14.9 collection/amd/AmdGpuData#procs.: (!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().()).then_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core bool/impl#[bool]then_some().((total_mem, proc_vec)), |
| 443 | }) |
| 444 | } |