1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define TRACE_SYSTEM power
5 #if !defined(LTTNG_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_POWER_H
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/ktime.h>
10 #include <linux/version.h>
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
)
62 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
63 LTTNG_TRACEPOINT_EVENT_CLASS(power_wakeup_source
,
65 TP_PROTO(const char *name
, unsigned int state
),
70 ctf_string(name
, name
)
71 ctf_integer(u64
, state
, state
)
75 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source
, wakeup_source_activate
,
77 power_wakeup_source_activate
,
79 TP_PROTO(const char *name
, unsigned int state
),
84 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source
, wakeup_source_deactivate
,
86 power_wakeup_source_deactivate
,
88 TP_PROTO(const char *name
, unsigned int state
),
94 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
97 * The power events are used for cpuidle & suspend (power_start, power_end)
98 * and for cpufreq (power_frequency)
100 LTTNG_TRACEPOINT_EVENT_CLASS(power
,
102 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
104 TP_ARGS(type
, state
, cpu_id
),
107 ctf_integer(u64
, type
, type
)
108 ctf_integer(u64
, state
, state
)
109 ctf_integer(u64
, cpu_id
, cpu_id
)
113 LTTNG_TRACEPOINT_EVENT_INSTANCE(power
, power_start
,
115 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
117 TP_ARGS(type
, state
, cpu_id
)
120 LTTNG_TRACEPOINT_EVENT_INSTANCE(power
, power_frequency
,
122 TP_PROTO(unsigned int type
, unsigned int state
, unsigned int cpu_id
),
124 TP_ARGS(type
, state
, cpu_id
)
127 LTTNG_TRACEPOINT_EVENT(power_end
,
129 TP_PROTO(unsigned int cpu_id
),
134 ctf_integer(u64
, cpu_id
, cpu_id
)
138 /* Deprecated dummy functions must be protected against multi-declartion */
139 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
140 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
147 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
149 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
151 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
152 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
159 /* These dummy declaration have to be ripped out when the deprecated
160 events get removed */
161 static inline void trace_power_start(u64 type
, u64 state
, u64 cpuid
) {};
162 static inline void trace_power_end(u64 cpuid
) {};
163 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
164 static inline void trace_power_start_rcuidle(u64 type
, u64 state
, u64 cpuid
) {};
165 static inline void trace_power_end_rcuidle(u64 cpuid
) {};
167 static inline void trace_power_frequency(u64 type
, u64 state
, u64 cpuid
) {};
168 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
170 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
173 * The clock events are used for clock enable/disable and for
176 LTTNG_TRACEPOINT_EVENT_CLASS(power_clock
,
178 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
180 TP_ARGS(name
, state
, cpu_id
),
183 ctf_string(name
, name
)
184 ctf_integer(u64
, state
, state
)
185 ctf_integer(u64
, cpu_id
, cpu_id
)
189 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock
, clock_enable
,
193 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
195 TP_ARGS(name
, state
, cpu_id
)
198 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock
, clock_disable
,
202 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
204 TP_ARGS(name
, state
, cpu_id
)
207 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock
, clock_set_rate
,
209 power_clock_set_rate
,
211 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
213 TP_ARGS(name
, state
, cpu_id
)
217 * The power domain events are used for power domains transitions
219 LTTNG_TRACEPOINT_EVENT_CLASS(power_domain
,
221 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
223 TP_ARGS(name
, state
, cpu_id
),
226 ctf_string(name
, name
)
227 ctf_integer(u64
, state
, state
)
228 ctf_integer(u64
, cpu_id
, cpu_id
)
232 LTTNG_TRACEPOINT_EVENT_INSTANCE(power_domain
, power_domain_target
,
234 TP_PROTO(const char *name
, unsigned int state
, unsigned int cpu_id
),
236 TP_ARGS(name
, state
, cpu_id
)
239 #endif /* LTTNG_TRACE_POWER_H */
241 /* This part must be outside protection */
242 #include <probes/define_trace.h>