why was this collecting

This commit is contained in:
ClementTsang 2025-09-01 05:28:03 -04:00
parent 8343fb778e
commit 2900ed03c0
No known key found for this signature in database
GPG Key ID: DC3B7867D8D97095

View File

@ -237,26 +237,24 @@ fn get_amd_fdinfo(device_path: &Path) -> Option<HashMap<u32, AmdGpuProc>> {
return None; return None;
}; };
let pids: Vec<u32> = proc_dir let pids = proc_dir.filter_map(|dir_entry| {
.filter_map(|dir_entry| { // check if pid is valid
// check if pid is valid let dir_entry = dir_entry.ok()?;
let dir_entry = dir_entry.ok()?; let metadata = dir_entry.metadata().ok()?;
let metadata = dir_entry.metadata().ok()?;
if !metadata.is_dir() { if !metadata.is_dir() {
return None; return None;
} }
let pid = dir_entry.file_name().to_str()?.parse::<u32>().ok()?; let pid = dir_entry.file_name().to_str()?.parse::<u32>().ok()?;
// skip init process // skip init process/systemd
if pid == 1 { if pid == 1 {
return None; return None;
} }
Some(pid) Some(pid)
}) });
.collect();
for pid in pids { for pid in pids {
// collect file descriptors that point to our device renderers // collect file descriptors that point to our device renderers