Skip to contentSkip to conversation

cpupower: idle_monitor: fix incorrect value logged after stop

PATCH New Kaushlendra Kumar 1 participant 1 message Dec 2, 2025 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpupower: idle_monitor: fix incorrect value logged after stop

The cpuidle sysfs monitor printed the previous sample’s counter value in cpuidle_stop() instead of the freshly read one. The dprint line used previous_count[cpu][state] while current_count[cpu][state] had just been populated. This caused misleading debug output.

Switch the logging to current_count so the post-interval snapshot matches the displayed value.

---
 tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +1 -1
index 8b42c2f0a5b0..4225eff9833d 100644
@@ -70,7 +70,7 @@ static int cpuidle_stop(void)
 			current_count[cpu][state] =
 				cpuidle_state_time(cpu, state);
 			dprint("CPU %d - State: %d - Val: %llu\n",
-			       cpu, state, previous_count[cpu][state]);
+			       cpu, state, current_count[cpu][state]);
 		}
 	}
 	return 0;
Signature · 1 line
2.34.1