Skip to content

Commit 76fb981

Browse files
AboorvaDevarajanshuahkh
authored andcommitted
tools/cpupower: display residency value in idle-info
Update cpuidle tool to display the residency value of cpuidle states. This addition provides a clearer and more detailed view of idle state information when using cpuidle-info. -------------------------------- Before Patch: -------------------------------- $ cpupower idle-info CPUidle driver: intel_idle CPUidle governor: menu analyzing CPU 28: Number of idle states: 3 Available idle states: POLL C1 C1E POLL: Flags/Description: CPUIDLE CORE POLL IDLE Latency: 0 Usage: 7448 Duration: 207170 C1: Flags/Description: MWAIT 0x00 Latency: 2 Usage: 7023 Duration: 3736853 C1E: Flags/Description: MWAIT 0x01 Latency: 10 Usage: 18468 Duration: 11396212 -------------------------------- After Patch: -------------------------------- $ cpupower idle-info CPUidle driver: intel_idle CPUidle governor: menu analyzing CPU 12: Number of idle states: 3 Available idle states: POLL C1 C1E POLL: Flags/Description: CPUIDLE CORE POLL IDLE Latency: 0 Residency: 0 Usage: 1950 Duration: 38458 C1: Flags/Description: MWAIT 0x00 Latency: 2 Residency: 2 Usage: 10688 Duration: 7133020 C1E: Flags/Description: MWAIT 0x01 Latency: 10 Residency: 20 Usage: 22356 Duration: 15687259 -------------------------------- Signed-off-by: Aboorva Devarajan <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 8400291 commit 76fb981

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

tools/power/cpupower/lib/cpuidle.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ enum idlestate_value {
116116
IDLESTATE_USAGE,
117117
IDLESTATE_POWER,
118118
IDLESTATE_LATENCY,
119+
IDLESTATE_RESIDENCY,
119120
IDLESTATE_TIME,
120121
IDLESTATE_DISABLE,
121122
MAX_IDLESTATE_VALUE_FILES
@@ -125,6 +126,7 @@ static const char *idlestate_value_files[MAX_IDLESTATE_VALUE_FILES] = {
125126
[IDLESTATE_USAGE] = "usage",
126127
[IDLESTATE_POWER] = "power",
127128
[IDLESTATE_LATENCY] = "latency",
129+
[IDLESTATE_RESIDENCY] = "residency",
128130
[IDLESTATE_TIME] = "time",
129131
[IDLESTATE_DISABLE] = "disable",
130132
};
@@ -254,6 +256,12 @@ unsigned long cpuidle_state_latency(unsigned int cpu,
254256
return cpuidle_state_get_one_value(cpu, idlestate, IDLESTATE_LATENCY);
255257
}
256258

259+
unsigned long cpuidle_state_residency(unsigned int cpu,
260+
unsigned int idlestate)
261+
{
262+
return cpuidle_state_get_one_value(cpu, idlestate, IDLESTATE_RESIDENCY);
263+
}
264+
257265
unsigned long cpuidle_state_usage(unsigned int cpu,
258266
unsigned int idlestate)
259267
{

tools/power/cpupower/lib/cpuidle.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ int cpuidle_state_disable(unsigned int cpu, unsigned int idlestate,
88
unsigned int disable);
99
unsigned long cpuidle_state_latency(unsigned int cpu,
1010
unsigned int idlestate);
11+
unsigned long cpuidle_state_residency(unsigned int cpu,
12+
unsigned int idlestate);
1113
unsigned long cpuidle_state_usage(unsigned int cpu,
1214
unsigned int idlestate);
1315
unsigned long long cpuidle_state_time(unsigned int cpu,

tools/power/cpupower/utils/cpuidle-info.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ static void cpuidle_cpu_output(unsigned int cpu, int verbose)
6464

6565
printf(_("Latency: %lu\n"),
6666
cpuidle_state_latency(cpu, idlestate));
67+
printf(_("Residency: %lu\n"),
68+
cpuidle_state_residency(cpu, idlestate));
6769
printf(_("Usage: %lu\n"),
6870
cpuidle_state_usage(cpu, idlestate));
6971
printf(_("Duration: %llu\n"),
@@ -115,6 +117,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
115117
printf(_("promotion[--] demotion[--] "));
116118
printf(_("latency[%03lu] "),
117119
cpuidle_state_latency(cpu, cstate));
120+
printf(_("residency[%05lu] "),
121+
cpuidle_state_residency(cpu, cstate));
118122
printf(_("usage[%08lu] "),
119123
cpuidle_state_usage(cpu, cstate));
120124
printf(_("duration[%020Lu] \n"),

0 commit comments

Comments
 (0)