Update to SPDX v3.0 identifiers
[deliverable/lttng-modules.git] / instrumentation / events / lttng-module / power.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM power
4
5 #if !defined(LTTNG_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_POWER_H
7
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/ktime.h>
10 #include <linux/version.h>
11
12 LTTNG_TRACEPOINT_EVENT_CLASS(power_cpu,
13
14 TP_PROTO(unsigned int state, unsigned int cpu_id),
15
16 TP_ARGS(state, cpu_id),
17
18 TP_FIELDS(
19 ctf_integer(u32, state, state)
20 ctf_integer(u32, cpu_id, cpu_id)
21 )
22 )
23
24 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_idle,
25
26 power_cpu_idle,
27
28 TP_PROTO(unsigned int state, unsigned int cpu_id),
29
30 TP_ARGS(state, cpu_id)
31 )
32
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
36
37 #define PWR_EVENT_EXIT -1
38 #endif
39
40 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_frequency,
41
42 power_cpu_frequency,
43
44 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
45
46 TP_ARGS(frequency, cpu_id)
47 )
48
49 LTTNG_TRACEPOINT_EVENT_MAP(machine_suspend,
50
51 power_machine_suspend,
52
53 TP_PROTO(unsigned int state),
54
55 TP_ARGS(state),
56
57 TP_FIELDS(
58 ctf_integer(u32, state, state)
59 )
60 )
61
62 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
63 LTTNG_TRACEPOINT_EVENT_CLASS(power_wakeup_source,
64
65 TP_PROTO(const char *name, unsigned int state),
66
67 TP_ARGS(name, state),
68
69 TP_FIELDS(
70 ctf_string(name, name)
71 ctf_integer(u64, state, state)
72 )
73 )
74
75 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_activate,
76
77 power_wakeup_source_activate,
78
79 TP_PROTO(const char *name, unsigned int state),
80
81 TP_ARGS(name, state)
82 )
83
84 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_deactivate,
85
86 power_wakeup_source_deactivate,
87
88 TP_PROTO(const char *name, unsigned int state),
89
90 TP_ARGS(name, state)
91 )
92 #endif
93
94 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
95
96 /*
97 * The power events are used for cpuidle & suspend (power_start, power_end)
98 * and for cpufreq (power_frequency)
99 */
100 LTTNG_TRACEPOINT_EVENT_CLASS(power,
101
102 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
103
104 TP_ARGS(type, state, cpu_id),
105
106 TP_FIELDS(
107 ctf_integer(u64, type, type)
108 ctf_integer(u64, state, state)
109 ctf_integer(u64, cpu_id, cpu_id)
110 )
111 )
112
113 LTTNG_TRACEPOINT_EVENT_INSTANCE(power, power_start,
114
115 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
116
117 TP_ARGS(type, state, cpu_id)
118 )
119
120 LTTNG_TRACEPOINT_EVENT_INSTANCE(power, power_frequency,
121
122 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
123
124 TP_ARGS(type, state, cpu_id)
125 )
126
127 LTTNG_TRACEPOINT_EVENT(power_end,
128
129 TP_PROTO(unsigned int cpu_id),
130
131 TP_ARGS(cpu_id),
132
133 TP_FIELDS(
134 ctf_integer(u64, cpu_id, cpu_id)
135 )
136 )
137
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
141
142 enum {
143 POWER_NONE = 0,
144 POWER_CSTATE = 1,
145 POWER_PSTATE = 2,
146 };
147 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
148
149 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
150
151 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
152 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
153 enum {
154 POWER_NONE = 0,
155 POWER_CSTATE = 1,
156 POWER_PSTATE = 2,
157 };
158
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) {};
166 #endif
167 static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
168 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
169
170 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
171
172 /*
173 * The clock events are used for clock enable/disable and for
174 * clock rate change
175 */
176 LTTNG_TRACEPOINT_EVENT_CLASS(power_clock,
177
178 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
179
180 TP_ARGS(name, state, cpu_id),
181
182 TP_FIELDS(
183 ctf_string(name, name)
184 ctf_integer(u64, state, state)
185 ctf_integer(u64, cpu_id, cpu_id)
186 )
187 )
188
189 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_enable,
190
191 power_clock_enable,
192
193 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
194
195 TP_ARGS(name, state, cpu_id)
196 )
197
198 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_disable,
199
200 power_clock_disable,
201
202 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
203
204 TP_ARGS(name, state, cpu_id)
205 )
206
207 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_set_rate,
208
209 power_clock_set_rate,
210
211 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
212
213 TP_ARGS(name, state, cpu_id)
214 )
215
216 /*
217 * The power domain events are used for power domains transitions
218 */
219 LTTNG_TRACEPOINT_EVENT_CLASS(power_domain,
220
221 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
222
223 TP_ARGS(name, state, cpu_id),
224
225 TP_FIELDS(
226 ctf_string(name, name)
227 ctf_integer(u64, state, state)
228 ctf_integer(u64, cpu_id, cpu_id)
229 )
230 )
231
232 LTTNG_TRACEPOINT_EVENT_INSTANCE(power_domain, power_domain_target,
233
234 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
235
236 TP_ARGS(name, state, cpu_id)
237 )
238
239 #endif /* LTTNG_TRACE_POWER_H */
240
241 /* This part must be outside protection */
242 #include <probes/define_trace.h>
This page took 0.042683 seconds and 5 git commands to generate.