From d2771bfb46a58d8767a59526229697e807659589 Mon Sep 17 00:00:00 2001 From: 17314642 <48242771@protonmail.ch> Date: Sun, 30 Aug 2026 14:38:18 +0000 Subject: [PATCH] next: do not poll metrics after exceeding gpu_metrics_sample_count After polling 20 times in a row, while loop continued to poll gpu stats without sleep, which lead to Intel Arc gpus showing -inf or nan values for power usage, because of delta being divided by 0 ms in Intel_i915::get_power_usage() line 48 --- mangohud-next/server/metrics/gpu/gpu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mangohud-next/server/metrics/gpu/gpu.cpp b/mangohud-next/server/metrics/gpu/gpu.cpp index f8617911d9..1dd6c408d3 100644 --- a/mangohud-next/server/metrics/gpu/gpu.cpp +++ b/mangohud-next/server/metrics/gpu/gpu.cpp @@ -29,6 +29,9 @@ void GPU::poll() { if (stop_thread) break; + if (samples >= gpu_metrics_sample_count) + continue; + auto current_time = std::chrono::steady_clock::now(); delta_time_ns = current_time - previous_time; previous_time = current_time; @@ -85,9 +88,6 @@ void GPU::poll() { samples++; - if (samples >= gpu_metrics_sample_count) - continue; - auto elapsed = std::chrono::steady_clock::now() - current_time; if (elapsed < gpu_metrics_polling_period) std::this_thread::sleep_for(gpu_metrics_polling_period - elapsed);