2 #define TRACE_SYSTEM power
4 #if !defined(LTTNG_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_POWER_H
7 #include <probes/lttng-tracepoint-event.h>
8 #include <linux/ktime.h>
9 #include <linux/version.h>
11 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
12 LTTNG_TRACEPOINT_EVENT_CLASS(power_cpu
,
14 TP_PROTO(unsigned int state
, unsigned int cpu_id
),
16 TP_ARGS(state
, cpu_id
),
19 ctf_integer(u32
, state
, state
)
20 ctf_integer(u32
, cpu_id
, cpu_id
)
24 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu
, cpu_idle
,
28 TP_PROTO(unsigned int state
, unsigned int cpu_id
),
30 TP_ARGS(state
, cpu_id
)
33 /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
34 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
35 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
37 #define PWR_EVENT_EXIT -1
40 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu
, cpu_frequency
,
44 TP_PROTO(unsigned int frequency
, unsigned int cpu_id
),
46 TP_ARGS(frequency
, cpu_id
)
49 LTTNG_TRACEPOINT_EVENT_MAP(machine_suspend
,
51 power_machine_suspend
,
53 TP_PROTO(unsigned int state
),
58 ctf_integer(u32
, state
, state
)
63 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
64 LTTNG_TRACEPOINT_EVENT_CLASS(power_wakeup_source
,
66 TP_PROTO(const char *name
, unsigned int state
),
71 ctf_string(name
, name
)
72 ctf_integer(u64
, state
, state
)
76 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source
, wakeup_source_activate
,
78 power_wakeup_source_activate
,
80 TP_PROTO(const char *name
, unsigned int state
),
85 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source
, wakeup_source_deactivate
,
87 power_wakeup_source_deactivate
,
89 TP_PROTO(const char *name
, unsigned int state
),
95 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
96 #undef CONFIG_EVENT_POWER_TRACING_DEPRECATED
97 #define CONFIG_EVENT_POWER_TRACING_DEPRECATED
98 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
101 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
104 * The power events are used for cpuidle & suspend (power_start, power_end)
105 * and for cpufreq (power_frequency)
107 LTTNG_TRACEPOINT_EVENT_CLASS(power
,
109 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
110 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
112 TP_ARGS(type
, state
, cpu_id
),
114 TP_PROTO(unsigned int type
, unsigned int state
),
116 TP_ARGS(type
, state
),
120 ctf_integer(u64
, type
, type
)
121 ctf_integer(u64
, state
, state
)
122 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
123 ctf_integer(u64
, cpu_id
, cpu_id
)
128 LTTNG_TRACEPOINT_EVENT_INSTANCE(power
, power_start
,
130 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
131 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
133 TP_ARGS(type
, state
, cpu_id
)
135 TP_PROTO(unsigned int type
, unsigned int state
),
141 LTTNG_TRACEPOINT_EVENT_INSTANCE(power
, power_frequency
,
143 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
144 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
146 TP_ARGS(type
, state
, cpu_id
)
148 TP_PROTO(unsigned int type
, unsigned int state
),
154 LTTNG_TRACEPOINT_EVENT(power_end
,
156 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
157 TP_PROTO(unsigned int cpu_id
),
167 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
168 ctf_integer(u64
, cpu_id
, cpu_id
)
170 ctf_integer(u64
, dummy
, 0xffff)
175 /* Deprecated dummy functions must be protected against multi-declartion */
176 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
177 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
184 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
186 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
188 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
189 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
196 /* These dummy declaration have to be ripped out when the deprecated
197 events get removed */
198 static inline void trace_power_start(u64 type
, u64 state
, u64 cpuid
) {};
199 static inline void trace_power_end(u64 cpuid
) {};
200 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
201 static inline void trace_power_start_rcuidle(u64 type
, u64 state
, u64 cpuid
) {};
202 static inline void trace_power_end_rcuidle(u64 cpuid
) {};
204 static inline void trace_power_frequency(u64 type
, u64 state
, u64 cpuid
) {};
205 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
207 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
209 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
211 * The clock events are used for clock enable/disable and for
214 LTTNG_TRACEPOINT_EVENT_CLASS(power_clock
,
216 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
218 TP_ARGS(name
, state
, cpu_id
),
221 ctf_string(name
, name
)
222 ctf_integer(u64
, state
, state
)
223 ctf_integer(u64
, cpu_id
, cpu_id
)
227 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock
, clock_enable
,
231 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
233 TP_ARGS(name
, state
, cpu_id
)
236 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock
, clock_disable
,
240 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
242 TP_ARGS(name
, state
, cpu_id
)
245 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock
, clock_set_rate
,
247 power_clock_set_rate
,
249 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
251 TP_ARGS(name
, state
, cpu_id
)
255 * The power domain events are used for power domains transitions
257 LTTNG_TRACEPOINT_EVENT_CLASS(power_domain
,
259 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
261 TP_ARGS(name
, state
, cpu_id
),
264 ctf_string(name
, name
)
265 ctf_integer(u64
, state
, state
)
266 ctf_integer(u64
, cpu_id
, cpu_id
)
270 LTTNG_TRACEPOINT_EVENT_INSTANCE(power_domain
, power_domain_target
,
272 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
274 TP_ARGS(name
, state
, cpu_id
)
278 #endif /* LTTNG_TRACE_POWER_H */
280 /* This part must be outside protection */
281 #include <probes/define_trace.h>