diff options
author | Kajetan Puchalski <kajetan.puchalski@arm.com> | 2022-07-26 13:24:04 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-08-03 18:50:58 +0300 |
commit | 6ab4b1990097b76508bd6dffd85ffcacbedb26b2 (patch) | |
tree | 280fa2bb6407f60d26be864458ebdf31b6d26e95 /drivers | |
parent | a771ea6413c00cf4af0570745f2e27084d7e2376 (diff) | |
download | linux-6ab4b1990097b76508bd6dffd85ffcacbedb26b2.tar.xz |
cpuidle: Add cpu_idle_miss trace event
Add a trace event for cpuidle to track missed (too deep or too shallow)
wakeups.
After each wakeup, CPUIdle already computes whether the entered state was
optimal, above or below the desired one and updates the relevant
counters. This patch makes it possible to trace those events in addition
to just reading the counters.
The patterns of types and percentages of misses across different
workloads appear to be very consistent. This makes the trace event very
useful for comparing the relative correctness of different CPUIdle
governors for different types of workloads, or for finding the
optimal governor for a given device.
Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index ef2ea1b12cd8..bf57cab32456 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -8,6 +8,7 @@ * This code is licenced under the GPL. */ +#include "linux/percpu-defs.h" #include <linux/clockchips.h> #include <linux/kernel.h> #include <linux/mutex.h> @@ -278,6 +279,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, /* Shallower states are enabled, so update. */ dev->states_usage[entered_state].above++; + trace_cpu_idle_miss(dev->cpu, entered_state, false); break; } } else if (diff > delay) { @@ -289,8 +291,10 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, * Update if a deeper state would have been a * better match for the observed idle duration. */ - if (diff - delay >= drv->states[i].target_residency_ns) + if (diff - delay >= drv->states[i].target_residency_ns) { dev->states_usage[entered_state].below++; + trace_cpu_idle_miss(dev->cpu, entered_state, true); + } break; } |