diff mbox series

[v2,2/2] PM / Domains: Add trace event for genpd_set_performance_state

Message ID 20191002113736.v2.2.I366ab5442f66ddff643948c6923cc6916ddfd840@changeid (mailing list archive)
State Not Applicable, archived
Headers show
Series [v2,1/2] PM / Domains: Add genpd_power_on/off trace events | expand

Commit Message

Matthias Kaehlcke Oct. 2, 2019, 6:37 p.m. UTC
Tracking the performance state can be useful for
debugging/understanding power domain behavior.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

Changes in v2:
- split original patch in two, one for genpd_set_performance_state
  one for genpd_power_on/off
- updated commit message (original subject was "PM / Domains: Add
  tracepoints")

 drivers/base/power/domain.c  |  3 +++
 include/trace/events/power.h | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 88eff9c4e79a..1130b984808d 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -332,6 +332,9 @@  static int _genpd_set_performance_state(struct generic_pm_domain *genpd,
 		goto err;
 
 	genpd->performance_state = state;
+
+	trace_genpd_set_performance_state(genpd);
+
 	return 0;
 
 err:
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index d92cb53c20ed..2c2c7bb5bef0 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -559,6 +559,24 @@  DEFINE_EVENT(genpd_power_on_off, genpd_power_off,
 
 	TP_ARGS(genpd)
 );
+
+TRACE_EVENT(genpd_set_performance_state,
+	TP_PROTO(struct generic_pm_domain *genpd),
+
+	TP_ARGS(genpd),
+
+	TP_STRUCT__entry(
+		__string(name, genpd->name)
+		__field(unsigned int, state)
+	),
+
+	TP_fast_assign(
+		__assign_str(name, genpd->name);
+		__entry->state = genpd->performance_state;
+	),
+
+	TP_printk("name=%s state=%u", __get_str(name), __entry->state)
+);
 #endif /* CONFIG_PM_GENERIC_DOMAINS */
 #endif /* _TRACE_POWER_H */