aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace/events/power.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace/events/power.h')
-rw-r--r--include/trace/events/power.h84
1 files changed, 58 insertions, 26 deletions
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 9a7e08d61258..d19840b0cac8 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -7,6 +7,9 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h> 8#include <linux/pm_qos.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/ftrace_event.h>
11
12#define TPS(x) tracepoint_string(x)
10 13
11DECLARE_EVENT_CLASS(cpu, 14DECLARE_EVENT_CLASS(cpu,
12 15
@@ -90,6 +93,17 @@ TRACE_EVENT(pstate_sample,
90#define PWR_EVENT_EXIT -1 93#define PWR_EVENT_EXIT -1
91#endif 94#endif
92 95
96#define pm_verb_symbolic(event) \
97 __print_symbolic(event, \
98 { PM_EVENT_SUSPEND, "suspend" }, \
99 { PM_EVENT_RESUME, "resume" }, \
100 { PM_EVENT_FREEZE, "freeze" }, \
101 { PM_EVENT_QUIESCE, "quiesce" }, \
102 { PM_EVENT_HIBERNATE, "hibernate" }, \
103 { PM_EVENT_THAW, "thaw" }, \
104 { PM_EVENT_RESTORE, "restore" }, \
105 { PM_EVENT_RECOVER, "recover" })
106
93DEFINE_EVENT(cpu, cpu_frequency, 107DEFINE_EVENT(cpu, cpu_frequency,
94 108
95 TP_PROTO(unsigned int frequency, unsigned int cpu_id), 109 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
@@ -97,58 +111,76 @@ DEFINE_EVENT(cpu, cpu_frequency,
97 TP_ARGS(frequency, cpu_id) 111 TP_ARGS(frequency, cpu_id)
98); 112);
99 113
100TRACE_EVENT(machine_suspend, 114TRACE_EVENT(device_pm_callback_start,
101 115
102 TP_PROTO(unsigned int state), 116 TP_PROTO(struct device *dev, const char *pm_ops, int event),
103 117
104 TP_ARGS(state), 118 TP_ARGS(dev, pm_ops, event),
105 119
106 TP_STRUCT__entry( 120 TP_STRUCT__entry(
107 __field( u32, state ) 121 __string(device, dev_name(dev))
122 __string(driver, dev_driver_string(dev))
123 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
124 __string(pm_ops, pm_ops ? pm_ops : "none ")
125 __field(int, event)
108 ), 126 ),
109 127
110 TP_fast_assign( 128 TP_fast_assign(
111 __entry->state = state; 129 __assign_str(device, dev_name(dev));
130 __assign_str(driver, dev_driver_string(dev));
131 __assign_str(parent,
132 dev->parent ? dev_name(dev->parent) : "none");
133 __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
134 __entry->event = event;
112 ), 135 ),
113 136
114 TP_printk("state=%lu", (unsigned long)__entry->state) 137 TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
138 __get_str(device), __get_str(parent), __get_str(pm_ops),
139 pm_verb_symbolic(__entry->event))
115); 140);
116 141
117TRACE_EVENT(device_pm_report_time, 142TRACE_EVENT(device_pm_callback_end,
118 143
119 TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time, 144 TP_PROTO(struct device *dev, int error),
120 char *pm_event_str, int error),
121 145
122 TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error), 146 TP_ARGS(dev, error),
123 147
124 TP_STRUCT__entry( 148 TP_STRUCT__entry(
125 __string(device, dev_name(dev)) 149 __string(device, dev_name(dev))
126 __string(driver, dev_driver_string(dev)) 150 __string(driver, dev_driver_string(dev))
127 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
128 __string(pm_ops, pm_ops ? pm_ops : "none ")
129 __string(pm_event_str, pm_event_str)
130 __field(s64, ops_time)
131 __field(int, error) 151 __field(int, error)
132 ), 152 ),
133 153
134 TP_fast_assign( 154 TP_fast_assign(
135 const char *tmp = dev->parent ? dev_name(dev->parent) : "none";
136 const char *tmp_i = pm_ops ? pm_ops : "none ";
137
138 __assign_str(device, dev_name(dev)); 155 __assign_str(device, dev_name(dev));
139 __assign_str(driver, dev_driver_string(dev)); 156 __assign_str(driver, dev_driver_string(dev));
140 __assign_str(parent, tmp);
141 __assign_str(pm_ops, tmp_i);
142 __assign_str(pm_event_str, pm_event_str);
143 __entry->ops_time = ops_time;
144 __entry->error = error; 157 __entry->error = error;
145 ), 158 ),
146 159
147 /* ops_str has an extra space at the end */ 160 TP_printk("%s %s, err=%d",
148 TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d", 161 __get_str(driver), __get_str(device), __entry->error)
149 __get_str(driver), __get_str(device), __get_str(parent), 162);
150 __get_str(pm_event_str), __get_str(pm_ops), 163
151 __entry->ops_time, __entry->error) 164TRACE_EVENT(suspend_resume,
165
166 TP_PROTO(const char *action, int val, bool start),
167
168 TP_ARGS(action, val, start),
169
170 TP_STRUCT__entry(
171 __field(const char *, action)
172 __field(int, val)
173 __field(bool, start)
174 ),
175
176 TP_fast_assign(
177 __entry->action = action;
178 __entry->val = val;
179 __entry->start = start;
180 ),
181
182 TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
183 (__entry->start)?"begin":"end")
152); 184);
153 185
154DECLARE_EVENT_CLASS(wakeup_source, 186DECLARE_EVENT_CLASS(wakeup_source,