Skip to content

Commit 3320601

Browse files
17314642flightlessmango
authored andcommitted
gpu_fdinfo: limit stats gathering to every 500ms
when printing stats while debugging, it spams the stdout, also why bother checking so frequently if gui updates every 500ms?
1 parent 55a1340 commit 3320601

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/gpu_fdinfo.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,15 @@ void GPU_fdinfo::get_load() {
168168
static uint64_t previous_gpu_time, previous_time, now, gpu_time_now;
169169
static float power_usage_now, previous_power_usage;
170170

171+
now = os_time_get_nano();
172+
173+
if (now - previous_time < METRICS_UPDATE_PERIOD_MS * 1'000'000)
174+
continue;
175+
171176
gpu_time_now = get_gpu_time();
172177
power_usage_now = get_power_usage();
173-
now = os_time_get_nano();
174178

175-
if (gpu_time_now > previous_gpu_time &&
176-
now - previous_time > METRICS_UPDATE_PERIOD_MS * 1'000'000) {
179+
if (gpu_time_now > previous_gpu_time) {
177180
float time_since_last = now - previous_time;
178181
float gpu_since_last = gpu_time_now - previous_gpu_time;
179182
float power_usage_since_last = power_usage_now - previous_power_usage;

0 commit comments

Comments
 (0)