Skip to main content

read_gpu_usage

Function read_gpu_usage 

Source
pub fn read_gpu_usage(proc_root: &Path, pid: Pid) -> Option<GpuUsage>
Expand description

Read /proc/<pid>/fdinfo/* and sum every DRM descriptor’s counters.

§Cost

One readdir plus one open/read per file descriptor. On a desktop this is a few thousand small reads per sample, which is why it is gated behind ScanOptions::gpu — the same treatment smaps_rollup gets. A process with no descriptors (kernel threads have no fd directory at all) costs one failed readdir.

None means “no GPU work visible”: either the process holds no DRM fd, or the files are unreadable because it belongs to another user.