On 2/5/26 19:58, Alex Deucher wrote:
Has anyone given any thought on how to support something like top for
accelerators or GPUs?
top for accelerators/GPUs kind of exists already, see [1] or [2].
Clearly, this problem has some kind of solution (looking through the
code, it seems like they check every fd if it has a DRM fdinfo file
associated (which is indeed not particularly efficient)).
Maybe it's worth asking the authors of the respective tools for their
opinions here?
Natalie
[1] https://github.com/Umio-Yasuno/amdgpu_top
[2] https://github.com/Syllo/nvtop
We have fdinfo, but using fdinfo requires extra
privileges (CAP_SYS_PTRACE) and there is not a particularly efficient
way to even discover what processes are using the GPU. There is the
clients list in debugfs, but that is also admin only. Tools like ps
and top use /proc/<pid>/stat and statm. Do you think there would be
an appetite for something like /proc/<pid>/drm/stat, statm, etc.?
This would duplicate much of what is in fdinfo, but would be available
to regular users.
Thanks,
Alex