This was created using Gemini 3 Pro and is a fork of the excellent Syllo/nvtop project.
This fork addresses specific issues with Intel Xe-based GPUs (specifically the Intel Arc B580 "Battlemage") when running in Snapshot Mode (nvtop -s).
On newer Intel drivers using the Xe kernel module, global hardware counters for GPU utilization are often unavailable or report as zero/null in headless environments. This results in standard monitoring tools outputting null for gpu_util and power_draw when used for scripting or dashboards.
The src/nvtop.c logic has been modified to support a "Triple-Pass" measurement strategy specifically for the -s flag.
The standard snapshot mode often reads sensors instantly, failing to capture the "delta" required to calculate usage and power. This fork implements a robust cycle:
- Warm-up Pass: Initializes the
fdinfoprocess list and wakes up the driver sensors. - Start Timestamp: Records the initial state of all running processes.
- Measurement Interval: Sleeps for 1 second to allow work to accumulate.
- Finish Timestamp: Records the final state.
Since the Battlemage B580 does not reliably report a "Global GPU Load" percentage via the Xe driver, this fork calculates the true GPU usage by:
- Scanning all active processes.
- Summing their individual Render (RCS), Compute (CCS), and Video (VCS/VECS) usage.
- Forcing this summed value into the global
gpu_utilfield.
To bypass internal validation flags that frequently mark Intel Xe data as "Invalid" (resulting in null output), the snapshot printer has been rewritten to:
- Directly output the calculated summation.
- Guarantee a valid integer output (0-100%) for
gpu_util. - Correctly format power draw (converting mW to W).
Build as normal:
mkdir build && cd build
cmake ..
make