SIGN IN SIGN UP

feat: compute Xe GPU utilization from gtidle/idle_residency_ms (#269)

* feat: compute Xe GPU utilization from gtidle/idle_residency_ms

The Xe kernel driver does not expose engine busy counters via sysfs
(unlike i915), so utilization was permanently 0 on Xe GPUs. The Xe
driver does expose gtidle/idle_residency_ms. We compute utilization from the
idle-time delta across scrape intervals, matching the semantics of
the existing engine-busy delta tracker.

- Add read_gtidle_ms() to intel_gpu_sysfs.rs
- Add GtidleState delta tracker
- Fall back to gtidle in get_gpu_info() when engine busy is unavailable
- Override detail[Utilization] and Source: Utilization label when
  gtidle provides data after apply_engine_readout sets the unavailable
  note

* fix: harden Xe gtidle utilization fallback

Use Xe GT idle residency only when DRM engine counters are unavailable so a valid zero-percent engine sample remains authoritative, and distinguish seeded or live zero-percent fallback data from an unavailable source.

Track gt0 and gt1 independently across partial reads, preserve per-GT elapsed time, and reseed counters after driver or device resets to avoid false 100-percent utilization spikes. Move the delta tracker into a focused module with regression coverage for fallback selection, zero utilization, counter resets, and missing GT files.

Validation: cargo fmt --check; cargo test; Linux Docker focused tests for intel_gpu_gtidle and intel_gpu_sysfs; cargo clippy -- -D warnings on macOS.

Refs #269

---------

Co-authored-by: Jeongkyu Shin <inureyes@gmail.com>
T
Titaniumtown committed
6587161d06480f34c190753adf22270d5236f5f3
Parent: d958828
Committed by GitHub <noreply@github.com> on 7/19/2026, 3:24:47 PM