Linux 4.1.18
[linux/fpc-iii.git] / include / trace / events / power.h
blobd19840b0cac844c8cd2fca6f4dac5d4bc62c75a3
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM power
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_POWER_H
7 #include <linux/ktime.h>
8 #include <linux/pm_qos.h>
9 #include <linux/tracepoint.h>
10 #include <linux/ftrace_event.h>
12 #define TPS(x) tracepoint_string(x)
14 DECLARE_EVENT_CLASS(cpu,
16 TP_PROTO(unsigned int state, unsigned int cpu_id),
18 TP_ARGS(state, cpu_id),
20 TP_STRUCT__entry(
21 __field( u32, state )
22 __field( u32, cpu_id )
25 TP_fast_assign(
26 __entry->state = state;
27 __entry->cpu_id = cpu_id;
30 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
31 (unsigned long)__entry->cpu_id)
34 DEFINE_EVENT(cpu, cpu_idle,
36 TP_PROTO(unsigned int state, unsigned int cpu_id),
38 TP_ARGS(state, cpu_id)
41 TRACE_EVENT(pstate_sample,
43 TP_PROTO(u32 core_busy,
44 u32 scaled_busy,
45 u32 state,
46 u64 mperf,
47 u64 aperf,
48 u32 freq
51 TP_ARGS(core_busy,
52 scaled_busy,
53 state,
54 mperf,
55 aperf,
56 freq
59 TP_STRUCT__entry(
60 __field(u32, core_busy)
61 __field(u32, scaled_busy)
62 __field(u32, state)
63 __field(u64, mperf)
64 __field(u64, aperf)
65 __field(u32, freq)
69 TP_fast_assign(
70 __entry->core_busy = core_busy;
71 __entry->scaled_busy = scaled_busy;
72 __entry->state = state;
73 __entry->mperf = mperf;
74 __entry->aperf = aperf;
75 __entry->freq = freq;
78 TP_printk("core_busy=%lu scaled=%lu state=%lu mperf=%llu aperf=%llu freq=%lu ",
79 (unsigned long)__entry->core_busy,
80 (unsigned long)__entry->scaled_busy,
81 (unsigned long)__entry->state,
82 (unsigned long long)__entry->mperf,
83 (unsigned long long)__entry->aperf,
84 (unsigned long)__entry->freq
89 /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
90 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
91 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
93 #define PWR_EVENT_EXIT -1
94 #endif
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" })
107 DEFINE_EVENT(cpu, cpu_frequency,
109 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
111 TP_ARGS(frequency, cpu_id)
114 TRACE_EVENT(device_pm_callback_start,
116 TP_PROTO(struct device *dev, const char *pm_ops, int event),
118 TP_ARGS(dev, pm_ops, event),
120 TP_STRUCT__entry(
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)
128 TP_fast_assign(
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;
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))
142 TRACE_EVENT(device_pm_callback_end,
144 TP_PROTO(struct device *dev, int error),
146 TP_ARGS(dev, error),
148 TP_STRUCT__entry(
149 __string(device, dev_name(dev))
150 __string(driver, dev_driver_string(dev))
151 __field(int, error)
154 TP_fast_assign(
155 __assign_str(device, dev_name(dev));
156 __assign_str(driver, dev_driver_string(dev));
157 __entry->error = error;
160 TP_printk("%s %s, err=%d",
161 __get_str(driver), __get_str(device), __entry->error)
164 TRACE_EVENT(suspend_resume,
166 TP_PROTO(const char *action, int val, bool start),
168 TP_ARGS(action, val, start),
170 TP_STRUCT__entry(
171 __field(const char *, action)
172 __field(int, val)
173 __field(bool, start)
176 TP_fast_assign(
177 __entry->action = action;
178 __entry->val = val;
179 __entry->start = start;
182 TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
183 (__entry->start)?"begin":"end")
186 DECLARE_EVENT_CLASS(wakeup_source,
188 TP_PROTO(const char *name, unsigned int state),
190 TP_ARGS(name, state),
192 TP_STRUCT__entry(
193 __string( name, name )
194 __field( u64, state )
197 TP_fast_assign(
198 __assign_str(name, name);
199 __entry->state = state;
202 TP_printk("%s state=0x%lx", __get_str(name),
203 (unsigned long)__entry->state)
206 DEFINE_EVENT(wakeup_source, wakeup_source_activate,
208 TP_PROTO(const char *name, unsigned int state),
210 TP_ARGS(name, state)
213 DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
215 TP_PROTO(const char *name, unsigned int state),
217 TP_ARGS(name, state)
221 * The clock events are used for clock enable/disable and for
222 * clock rate change
224 DECLARE_EVENT_CLASS(clock,
226 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
228 TP_ARGS(name, state, cpu_id),
230 TP_STRUCT__entry(
231 __string( name, name )
232 __field( u64, state )
233 __field( u64, cpu_id )
236 TP_fast_assign(
237 __assign_str(name, name);
238 __entry->state = state;
239 __entry->cpu_id = cpu_id;
242 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
243 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
246 DEFINE_EVENT(clock, clock_enable,
248 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
250 TP_ARGS(name, state, cpu_id)
253 DEFINE_EVENT(clock, clock_disable,
255 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
257 TP_ARGS(name, state, cpu_id)
260 DEFINE_EVENT(clock, clock_set_rate,
262 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
264 TP_ARGS(name, state, cpu_id)
268 * The power domain events are used for power domains transitions
270 DECLARE_EVENT_CLASS(power_domain,
272 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
274 TP_ARGS(name, state, cpu_id),
276 TP_STRUCT__entry(
277 __string( name, name )
278 __field( u64, state )
279 __field( u64, cpu_id )
282 TP_fast_assign(
283 __assign_str(name, name);
284 __entry->state = state;
285 __entry->cpu_id = cpu_id;
288 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
289 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
292 DEFINE_EVENT(power_domain, power_domain_target,
294 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
296 TP_ARGS(name, state, cpu_id)
300 * The pm qos events are used for pm qos update
302 DECLARE_EVENT_CLASS(pm_qos_request,
304 TP_PROTO(int pm_qos_class, s32 value),
306 TP_ARGS(pm_qos_class, value),
308 TP_STRUCT__entry(
309 __field( int, pm_qos_class )
310 __field( s32, value )
313 TP_fast_assign(
314 __entry->pm_qos_class = pm_qos_class;
315 __entry->value = value;
318 TP_printk("pm_qos_class=%s value=%d",
319 __print_symbolic(__entry->pm_qos_class,
320 { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
321 { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
322 { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
323 __entry->value)
326 DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
328 TP_PROTO(int pm_qos_class, s32 value),
330 TP_ARGS(pm_qos_class, value)
333 DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
335 TP_PROTO(int pm_qos_class, s32 value),
337 TP_ARGS(pm_qos_class, value)
340 DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
342 TP_PROTO(int pm_qos_class, s32 value),
344 TP_ARGS(pm_qos_class, value)
347 TRACE_EVENT(pm_qos_update_request_timeout,
349 TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
351 TP_ARGS(pm_qos_class, value, timeout_us),
353 TP_STRUCT__entry(
354 __field( int, pm_qos_class )
355 __field( s32, value )
356 __field( unsigned long, timeout_us )
359 TP_fast_assign(
360 __entry->pm_qos_class = pm_qos_class;
361 __entry->value = value;
362 __entry->timeout_us = timeout_us;
365 TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
366 __print_symbolic(__entry->pm_qos_class,
367 { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
368 { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
369 { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
370 __entry->value, __entry->timeout_us)
373 DECLARE_EVENT_CLASS(pm_qos_update,
375 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
377 TP_ARGS(action, prev_value, curr_value),
379 TP_STRUCT__entry(
380 __field( enum pm_qos_req_action, action )
381 __field( int, prev_value )
382 __field( int, curr_value )
385 TP_fast_assign(
386 __entry->action = action;
387 __entry->prev_value = prev_value;
388 __entry->curr_value = curr_value;
391 TP_printk("action=%s prev_value=%d curr_value=%d",
392 __print_symbolic(__entry->action,
393 { PM_QOS_ADD_REQ, "ADD_REQ" },
394 { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
395 { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
396 __entry->prev_value, __entry->curr_value)
399 DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
401 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
403 TP_ARGS(action, prev_value, curr_value)
406 DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
408 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
410 TP_ARGS(action, prev_value, curr_value),
412 TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
413 __print_symbolic(__entry->action,
414 { PM_QOS_ADD_REQ, "ADD_REQ" },
415 { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
416 { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
417 __entry->prev_value, __entry->curr_value)
420 DECLARE_EVENT_CLASS(dev_pm_qos_request,
422 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
423 s32 new_value),
425 TP_ARGS(name, type, new_value),
427 TP_STRUCT__entry(
428 __string( name, name )
429 __field( enum dev_pm_qos_req_type, type )
430 __field( s32, new_value )
433 TP_fast_assign(
434 __assign_str(name, name);
435 __entry->type = type;
436 __entry->new_value = new_value;
439 TP_printk("device=%s type=%s new_value=%d",
440 __get_str(name),
441 __print_symbolic(__entry->type,
442 { DEV_PM_QOS_RESUME_LATENCY, "DEV_PM_QOS_RESUME_LATENCY" },
443 { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
444 __entry->new_value)
447 DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
449 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
450 s32 new_value),
452 TP_ARGS(name, type, new_value)
455 DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
457 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
458 s32 new_value),
460 TP_ARGS(name, type, new_value)
463 DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
465 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
466 s32 new_value),
468 TP_ARGS(name, type, new_value)
470 #endif /* _TRACE_POWER_H */
472 /* This part must be outside protection */
473 #include <trace/define_trace.h>