2 #define TRACE_SYSTEM power
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/ktime.h>
8 #include <linux/pm_qos.h>
9 #include <linux/tracepoint.h>
11 DECLARE_EVENT_CLASS(cpu
,
13 TP_PROTO(unsigned int state
, unsigned int cpu_id
),
15 TP_ARGS(state
, cpu_id
),
19 __field( u32
, cpu_id
)
23 __entry
->state
= state
;
24 __entry
->cpu_id
= cpu_id
;
27 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry
->state
,
28 (unsigned long)__entry
->cpu_id
)
31 DEFINE_EVENT(cpu
, cpu_idle
,
33 TP_PROTO(unsigned int state
, unsigned int cpu_id
),
35 TP_ARGS(state
, cpu_id
)
38 TRACE_EVENT(pstate_sample
,
40 TP_PROTO(u32 core_busy
,
59 __field(u32
, core_busy
)
60 __field(u32
, scaled_busy
)
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
->energy
= energy
;
79 TP_printk("core_busy=%lu scaled=%lu state=%lu mperf=%llu aperf=%llu energy=%lu freq=%lu ",
80 (unsigned long)__entry
->core_busy
,
81 (unsigned long)__entry
->scaled_busy
,
82 (unsigned long)__entry
->state
,
83 (unsigned long long)__entry
->mperf
,
84 (unsigned long long)__entry
->aperf
,
85 (unsigned long)__entry
->energy
,
86 (unsigned long)__entry
->freq
91 /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
92 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
93 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
95 #define PWR_EVENT_EXIT -1
98 DEFINE_EVENT(cpu
, cpu_frequency
,
100 TP_PROTO(unsigned int frequency
, unsigned int cpu_id
),
102 TP_ARGS(frequency
, cpu_id
)
105 TRACE_EVENT(machine_suspend
,
107 TP_PROTO(unsigned int state
),
112 __field( u32
, state
)
116 __entry
->state
= state
;
119 TP_printk("state=%lu", (unsigned long)__entry
->state
)
122 TRACE_EVENT(device_pm_report_time
,
124 TP_PROTO(struct device
*dev
, const char *pm_ops
, s64 ops_time
,
125 char *pm_event_str
, int error
),
127 TP_ARGS(dev
, pm_ops
, ops_time
, pm_event_str
, error
),
130 __string(device
, dev_name(dev
))
131 __string(driver
, dev_driver_string(dev
))
132 __string(parent
, dev
->parent
? dev_name(dev
->parent
) : "none")
133 __string(pm_ops
, pm_ops
? pm_ops
: "none ")
134 __string(pm_event_str
, pm_event_str
)
135 __field(s64
, ops_time
)
140 const char *tmp
= dev
->parent
? dev_name(dev
->parent
) : "none";
141 const char *tmp_i
= pm_ops
? pm_ops
: "none ";
143 __assign_str(device
, dev_name(dev
));
144 __assign_str(driver
, dev_driver_string(dev
));
145 __assign_str(parent
, tmp
);
146 __assign_str(pm_ops
, tmp_i
);
147 __assign_str(pm_event_str
, pm_event_str
);
148 __entry
->ops_time
= ops_time
;
149 __entry
->error
= error
;
152 /* ops_str has an extra space at the end */
153 TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d",
154 __get_str(driver
), __get_str(device
), __get_str(parent
),
155 __get_str(pm_event_str
), __get_str(pm_ops
),
156 __entry
->ops_time
, __entry
->error
)
159 DECLARE_EVENT_CLASS(wakeup_source
,
161 TP_PROTO(const char *name
, unsigned int state
),
163 TP_ARGS(name
, state
),
166 __string( name
, name
)
167 __field( u64
, state
)
171 __assign_str(name
, name
);
172 __entry
->state
= state
;
175 TP_printk("%s state=0x%lx", __get_str(name
),
176 (unsigned long)__entry
->state
)
179 DEFINE_EVENT(wakeup_source
, wakeup_source_activate
,
181 TP_PROTO(const char *name
, unsigned int state
),
186 DEFINE_EVENT(wakeup_source
, wakeup_source_deactivate
,
188 TP_PROTO(const char *name
, unsigned int state
),
194 * The clock events are used for clock enable/disable and for
197 DECLARE_EVENT_CLASS(clock
,
199 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
201 TP_ARGS(name
, state
, cpu_id
),
204 __string( name
, name
)
205 __field( u64
, state
)
206 __field( u64
, cpu_id
)
210 __assign_str(name
, name
);
211 __entry
->state
= state
;
212 __entry
->cpu_id
= cpu_id
;
215 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name
),
216 (unsigned long)__entry
->state
, (unsigned long)__entry
->cpu_id
)
219 DEFINE_EVENT(clock
, clock_enable
,
221 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
223 TP_ARGS(name
, state
, cpu_id
)
226 DEFINE_EVENT(clock
, clock_disable
,
228 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
230 TP_ARGS(name
, state
, cpu_id
)
233 DEFINE_EVENT(clock
, clock_set_rate
,
235 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
237 TP_ARGS(name
, state
, cpu_id
)
241 * The power domain events are used for power domains transitions
243 DECLARE_EVENT_CLASS(power_domain
,
245 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
247 TP_ARGS(name
, state
, cpu_id
),
250 __string( name
, name
)
251 __field( u64
, state
)
252 __field( u64
, cpu_id
)
256 __assign_str(name
, name
);
257 __entry
->state
= state
;
258 __entry
->cpu_id
= cpu_id
;
261 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name
),
262 (unsigned long)__entry
->state
, (unsigned long)__entry
->cpu_id
)
265 DEFINE_EVENT(power_domain
, power_domain_target
,
267 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
269 TP_ARGS(name
, state
, cpu_id
)
273 * The pm qos events are used for pm qos update
275 DECLARE_EVENT_CLASS(pm_qos_request
,
277 TP_PROTO(int pm_qos_class
, s32 value
),
279 TP_ARGS(pm_qos_class
, value
),
282 __field( int, pm_qos_class
)
283 __field( s32
, value
)
287 __entry
->pm_qos_class
= pm_qos_class
;
288 __entry
->value
= value
;
291 TP_printk("pm_qos_class=%s value=%d",
292 __print_symbolic(__entry
->pm_qos_class
,
293 { PM_QOS_CPU_DMA_LATENCY
, "CPU_DMA_LATENCY" },
294 { PM_QOS_NETWORK_LATENCY
, "NETWORK_LATENCY" },
295 { PM_QOS_NETWORK_THROUGHPUT
, "NETWORK_THROUGHPUT" }),
299 DEFINE_EVENT(pm_qos_request
, pm_qos_add_request
,
301 TP_PROTO(int pm_qos_class
, s32 value
),
303 TP_ARGS(pm_qos_class
, value
)
306 DEFINE_EVENT(pm_qos_request
, pm_qos_update_request
,
308 TP_PROTO(int pm_qos_class
, s32 value
),
310 TP_ARGS(pm_qos_class
, value
)
313 DEFINE_EVENT(pm_qos_request
, pm_qos_remove_request
,
315 TP_PROTO(int pm_qos_class
, s32 value
),
317 TP_ARGS(pm_qos_class
, value
)
320 TRACE_EVENT(pm_qos_update_request_timeout
,
322 TP_PROTO(int pm_qos_class
, s32 value
, unsigned long timeout_us
),
324 TP_ARGS(pm_qos_class
, value
, timeout_us
),
327 __field( int, pm_qos_class
)
328 __field( s32
, value
)
329 __field( unsigned long, timeout_us
)
333 __entry
->pm_qos_class
= pm_qos_class
;
334 __entry
->value
= value
;
335 __entry
->timeout_us
= timeout_us
;
338 TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
339 __print_symbolic(__entry
->pm_qos_class
,
340 { PM_QOS_CPU_DMA_LATENCY
, "CPU_DMA_LATENCY" },
341 { PM_QOS_NETWORK_LATENCY
, "NETWORK_LATENCY" },
342 { PM_QOS_NETWORK_THROUGHPUT
, "NETWORK_THROUGHPUT" }),
343 __entry
->value
, __entry
->timeout_us
)
346 DECLARE_EVENT_CLASS(pm_qos_update
,
348 TP_PROTO(enum pm_qos_req_action action
, int prev_value
, int curr_value
),
350 TP_ARGS(action
, prev_value
, curr_value
),
353 __field( enum pm_qos_req_action
, action
)
354 __field( int, prev_value
)
355 __field( int, curr_value
)
359 __entry
->action
= action
;
360 __entry
->prev_value
= prev_value
;
361 __entry
->curr_value
= curr_value
;
364 TP_printk("action=%s prev_value=%d curr_value=%d",
365 __print_symbolic(__entry
->action
,
366 { PM_QOS_ADD_REQ
, "ADD_REQ" },
367 { PM_QOS_UPDATE_REQ
, "UPDATE_REQ" },
368 { PM_QOS_REMOVE_REQ
, "REMOVE_REQ" }),
369 __entry
->prev_value
, __entry
->curr_value
)
372 DEFINE_EVENT(pm_qos_update
, pm_qos_update_target
,
374 TP_PROTO(enum pm_qos_req_action action
, int prev_value
, int curr_value
),
376 TP_ARGS(action
, prev_value
, curr_value
)
379 DEFINE_EVENT_PRINT(pm_qos_update
, pm_qos_update_flags
,
381 TP_PROTO(enum pm_qos_req_action action
, int prev_value
, int curr_value
),
383 TP_ARGS(action
, prev_value
, curr_value
),
385 TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
386 __print_symbolic(__entry
->action
,
387 { PM_QOS_ADD_REQ
, "ADD_REQ" },
388 { PM_QOS_UPDATE_REQ
, "UPDATE_REQ" },
389 { PM_QOS_REMOVE_REQ
, "REMOVE_REQ" }),
390 __entry
->prev_value
, __entry
->curr_value
)
393 DECLARE_EVENT_CLASS(dev_pm_qos_request
,
395 TP_PROTO(const char *name
, enum dev_pm_qos_req_type type
,
398 TP_ARGS(name
, type
, new_value
),
401 __string( name
, name
)
402 __field( enum dev_pm_qos_req_type
, type
)
403 __field( s32
, new_value
)
407 __assign_str(name
, name
);
408 __entry
->type
= type
;
409 __entry
->new_value
= new_value
;
412 TP_printk("device=%s type=%s new_value=%d",
414 __print_symbolic(__entry
->type
,
415 { DEV_PM_QOS_LATENCY
, "DEV_PM_QOS_LATENCY" },
416 { DEV_PM_QOS_FLAGS
, "DEV_PM_QOS_FLAGS" }),
420 DEFINE_EVENT(dev_pm_qos_request
, dev_pm_qos_add_request
,
422 TP_PROTO(const char *name
, enum dev_pm_qos_req_type type
,
425 TP_ARGS(name
, type
, new_value
)
428 DEFINE_EVENT(dev_pm_qos_request
, dev_pm_qos_update_request
,
430 TP_PROTO(const char *name
, enum dev_pm_qos_req_type type
,
433 TP_ARGS(name
, type
, new_value
)
436 DEFINE_EVENT(dev_pm_qos_request
, dev_pm_qos_remove_request
,
438 TP_PROTO(const char *name
, enum dev_pm_qos_req_type type
,
441 TP_ARGS(name
, type
, new_value
)
443 #endif /* _TRACE_POWER_H */
445 /* This part must be outside protection */
446 #include <trace/define_trace.h>