Skip to main content

parse_fdinfo_drm

Function parse_fdinfo_drm 

Source
pub fn parse_fdinfo_drm(buf: &[u8]) -> Option<GpuUsage>
Expand description

Parse one fdinfo file for drm-* keys.

§The format

pos:    0
flags:    02100002
drm-driver:    nvidia-drm
drm-pdev:    0000:01:00.0
drm-engine-gfx:    12345678 ns
drm-engine-mem:    12345678 ns
drm-busy:    12345678 ns

Keys are driver-specific: drm-engine-<class> names vary (gfx, render, video, compute, …), and drm-busy / drm-memory-<region> only appear on some drivers. Engine classes are therefore summed by prefix rather than by name, and a missing drm-busy leaves GpuUsage::percent returning None instead of guessing.

Returns None when the file has no drm- key at all, which is the common case: most descriptors are not DRM.