2 #define TRACE_SYSTEM power
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/ktime.h>
8 #include <linux/tracepoint.h>
10 DECLARE_EVENT_CLASS(cpu
,
12 TP_PROTO(unsigned int state
, unsigned int cpu_id
),
14 TP_ARGS(state
, cpu_id
),
18 __field( u32
, cpu_id
)
22 __entry
->state
= state
;
23 __entry
->cpu_id
= cpu_id
;
26 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry
->state
,
27 (unsigned long)__entry
->cpu_id
)
30 DEFINE_EVENT(cpu
, cpu_idle
,
32 TP_PROTO(unsigned int state
, unsigned int cpu_id
),
34 TP_ARGS(state
, cpu_id
)
37 /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
38 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
39 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
41 #define PWR_EVENT_EXIT -1
44 DEFINE_EVENT(cpu
, cpu_frequency
,
46 TP_PROTO(unsigned int frequency
, unsigned int cpu_id
),
48 TP_ARGS(frequency
, cpu_id
)
51 TRACE_EVENT(machine_suspend
,
53 TP_PROTO(unsigned int state
),
62 __entry
->state
= state
;
65 TP_printk("state=%lu", (unsigned long)__entry
->state
)
68 DECLARE_EVENT_CLASS(wakeup_source
,
70 TP_PROTO(const char *name
, unsigned int state
),
75 __string( name
, name
)
80 __assign_str(name
, name
);
81 __entry
->state
= state
;
84 TP_printk("%s state=0x%lx", __get_str(name
),
85 (unsigned long)__entry
->state
)
88 DEFINE_EVENT(wakeup_source
, wakeup_source_activate
,
90 TP_PROTO(const char *name
, unsigned int state
),
95 DEFINE_EVENT(wakeup_source
, wakeup_source_deactivate
,
97 TP_PROTO(const char *name
, unsigned int state
),
102 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
105 * The power events are used for cpuidle & suspend (power_start, power_end)
106 * and for cpufreq (power_frequency)
108 DECLARE_EVENT_CLASS(power
,
110 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
112 TP_ARGS(type
, state
, cpu_id
),
116 __field( u64
, state
)
117 __field( u64
, cpu_id
)
121 __entry
->type
= type
;
122 __entry
->state
= state
;
123 __entry
->cpu_id
= cpu_id
;
126 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry
->type
,
127 (unsigned long)__entry
->state
, (unsigned long)__entry
->cpu_id
)
130 DEFINE_EVENT(power
, power_start
,
132 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
134 TP_ARGS(type
, state
, cpu_id
)
137 DEFINE_EVENT(power
, power_frequency
,
139 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
141 TP_ARGS(type
, state
, cpu_id
)
144 TRACE_EVENT(power_end
,
146 TP_PROTO(unsigned int cpu_id
),
151 __field( u64
, cpu_id
)
155 __entry
->cpu_id
= cpu_id
;
158 TP_printk("cpu_id=%lu", (unsigned long)__entry
->cpu_id
)
162 /* Deprecated dummy functions must be protected against multi-declartion */
163 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
164 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
171 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
173 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
175 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
176 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
183 /* These dummy declaration have to be ripped out when the deprecated
184 events get removed */
185 static inline void trace_power_start(u64 type
, u64 state
, u64 cpuid
) {};
186 static inline void trace_power_end(u64 cpuid
) {};
187 static inline void trace_power_start_rcuidle(u64 type
, u64 state
, u64 cpuid
) {};
188 static inline void trace_power_end_rcuidle(u64 cpuid
) {};
189 static inline void trace_power_frequency(u64 type
, u64 state
, u64 cpuid
) {};
190 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
192 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
195 * The clock events are used for clock enable/disable and for
198 DECLARE_EVENT_CLASS(clock
,
200 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
202 TP_ARGS(name
, state
, cpu_id
),
205 __string( name
, name
)
206 __field( u64
, state
)
207 __field( u64
, cpu_id
)
211 __assign_str(name
, name
);
212 __entry
->state
= state
;
213 __entry
->cpu_id
= cpu_id
;
216 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name
),
217 (unsigned long)__entry
->state
, (unsigned long)__entry
->cpu_id
)
220 DEFINE_EVENT(clock
, clock_enable
,
222 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
224 TP_ARGS(name
, state
, cpu_id
)
227 DEFINE_EVENT(clock
, clock_disable
,
229 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
231 TP_ARGS(name
, state
, cpu_id
)
234 DEFINE_EVENT(clock
, clock_set_rate
,
236 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
238 TP_ARGS(name
, state
, cpu_id
)
242 * The power domain events are used for power domains transitions
244 DECLARE_EVENT_CLASS(power_domain
,
246 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
248 TP_ARGS(name
, state
, cpu_id
),
251 __string( name
, name
)
252 __field( u64
, state
)
253 __field( u64
, cpu_id
)
257 __assign_str(name
, name
);
258 __entry
->state
= state
;
259 __entry
->cpu_id
= cpu_id
;
262 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name
),
263 (unsigned long)__entry
->state
, (unsigned long)__entry
->cpu_id
)
266 DEFINE_EVENT(power_domain
, power_domain_target
,
268 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
270 TP_ARGS(name
, state
, cpu_id
)
272 #endif /* _TRACE_POWER_H */
274 /* This part must be outside protection */
275 #include <trace/define_trace.h>