Extract input/output arguments from accept and connect syscalls
[lttng-modules.git] / instrumentation / events / lttng-module / power.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM power
3
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_POWER_H
6
7 #include <linux/ktime.h>
8 #include <linux/tracepoint.h>
9 #include <linux/version.h>
10
11 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
12 DECLARE_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_STRUCT__entry(
19 __field( u32, state )
20 __field( u32, cpu_id )
21 ),
22
23 TP_fast_assign(
24 tp_assign(state, state)
25 tp_assign(cpu_id, cpu_id)
26 ),
27
28 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
29 (unsigned long)__entry->cpu_id)
30 )
31
32 DEFINE_EVENT_MAP(power_cpu, cpu_idle,
33
34 power_cpu_idle,
35
36 TP_PROTO(unsigned int state, unsigned int cpu_id),
37
38 TP_ARGS(state, cpu_id)
39 )
40
41 /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
42 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
43 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
44
45 #define PWR_EVENT_EXIT -1
46 #endif
47
48 DEFINE_EVENT_MAP(power_cpu, cpu_frequency,
49
50 power_cpu_frequency,
51
52 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
53
54 TP_ARGS(frequency, cpu_id)
55 )
56
57 TRACE_EVENT_MAP(machine_suspend,
58
59 power_machine_suspend,
60
61 TP_PROTO(unsigned int state),
62
63 TP_ARGS(state),
64
65 TP_STRUCT__entry(
66 __field( u32, state )
67 ),
68
69 TP_fast_assign(
70 tp_assign(state, state)
71 ),
72
73 TP_printk("state=%lu", (unsigned long)__entry->state)
74 )
75 #endif
76
77 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
78 DECLARE_EVENT_CLASS(power_wakeup_source,
79
80 TP_PROTO(const char *name, unsigned int state),
81
82 TP_ARGS(name, state),
83
84 TP_STRUCT__entry(
85 __string( name, name )
86 __field( u64, state )
87 ),
88
89 TP_fast_assign(
90 tp_strcpy(name, name)
91 tp_assign(state, state)
92 ),
93
94 TP_printk("%s state=0x%lx", __get_str(name),
95 (unsigned long)__entry->state)
96 )
97
98 DEFINE_EVENT_MAP(power_wakeup_source, wakeup_source_activate,
99
100 power_wakeup_source_activate,
101
102 TP_PROTO(const char *name, unsigned int state),
103
104 TP_ARGS(name, state)
105 )
106
107 DEFINE_EVENT_MAP(power_wakeup_source, wakeup_source_deactivate,
108
109 power_wakeup_source_deactivate,
110
111 TP_PROTO(const char *name, unsigned int state),
112
113 TP_ARGS(name, state)
114 )
115 #endif
116
117 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
118 #undef CONFIG_EVENT_POWER_TRACING_DEPRECATED
119 #define CONFIG_EVENT_POWER_TRACING_DEPRECATED
120 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
121 #endif
122
123 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
124
125 /*
126 * The power events are used for cpuidle & suspend (power_start, power_end)
127 * and for cpufreq (power_frequency)
128 */
129 DECLARE_EVENT_CLASS(power,
130
131 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
132 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
133
134 TP_ARGS(type, state, cpu_id),
135 #else
136 TP_PROTO(unsigned int type, unsigned int state),
137
138 TP_ARGS(type, state),
139 #endif
140
141 TP_STRUCT__entry(
142 __field( u64, type )
143 __field( u64, state )
144 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
145 __field( u64, cpu_id )
146 #endif
147 ),
148
149 TP_fast_assign(
150 tp_assign(type, type)
151 tp_assign(state, state)
152 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
153 tp_assign(cpu_id, cpu_id)
154 #endif
155 ),
156
157 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
158 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
159 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
160 #else
161 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type,
162 (unsigned long)__entry->state)
163 #endif
164 )
165
166 DEFINE_EVENT(power, power_start,
167
168 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
169 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
170
171 TP_ARGS(type, state, cpu_id)
172 #else
173 TP_PROTO(unsigned int type, unsigned int state),
174
175 TP_ARGS(type, state)
176 #endif
177 )
178
179 DEFINE_EVENT(power, power_frequency,
180
181 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
182 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
183
184 TP_ARGS(type, state, cpu_id)
185 #else
186 TP_PROTO(unsigned int type, unsigned int state),
187
188 TP_ARGS(type, state)
189 #endif
190 )
191
192 TRACE_EVENT(power_end,
193
194 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
195 TP_PROTO(unsigned int cpu_id),
196
197 TP_ARGS(cpu_id),
198 #else
199 TP_PROTO(int dummy),
200
201 TP_ARGS(dummy),
202 #endif
203
204 TP_STRUCT__entry(
205 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
206 __field( u64, cpu_id )
207 #else
208 __field( u64, dummy )
209 #endif
210 ),
211
212 TP_fast_assign(
213 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
214 tp_assign(cpu_id, cpu_id)
215 #else
216 tp_assign(dummy, 0xffff)
217 #endif
218 ),
219
220 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
221 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
222 #else
223 TP_printk("dummy=%lu", (unsigned long)__entry->dummy)
224 #endif
225 )
226
227 /* Deprecated dummy functions must be protected against multi-declartion */
228 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
229 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
230
231 enum {
232 POWER_NONE = 0,
233 POWER_CSTATE = 1,
234 POWER_PSTATE = 2,
235 };
236 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
237
238 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
239
240 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
241 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
242 enum {
243 POWER_NONE = 0,
244 POWER_CSTATE = 1,
245 POWER_PSTATE = 2,
246 };
247
248 /* These dummy declaration have to be ripped out when the deprecated
249 events get removed */
250 static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
251 static inline void trace_power_end(u64 cpuid) {};
252 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
253 static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
254 static inline void trace_power_end_rcuidle(u64 cpuid) {};
255 #endif
256 static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
257 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
258
259 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
260
261 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
262 /*
263 * The clock events are used for clock enable/disable and for
264 * clock rate change
265 */
266 DECLARE_EVENT_CLASS(power_clock,
267
268 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
269
270 TP_ARGS(name, state, cpu_id),
271
272 TP_STRUCT__entry(
273 __string( name, name )
274 __field( u64, state )
275 __field( u64, cpu_id )
276 ),
277
278 TP_fast_assign(
279 tp_strcpy(name, name)
280 tp_assign(state, state)
281 tp_assign(cpu_id, cpu_id)
282 ),
283
284 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
285 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
286 )
287
288 DEFINE_EVENT_MAP(power_clock, clock_enable,
289
290 power_clock_enable,
291
292 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
293
294 TP_ARGS(name, state, cpu_id)
295 )
296
297 DEFINE_EVENT_MAP(power_clock, clock_disable,
298
299 power_clock_disable,
300
301 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
302
303 TP_ARGS(name, state, cpu_id)
304 )
305
306 DEFINE_EVENT_MAP(power_clock, clock_set_rate,
307
308 power_clock_set_rate,
309
310 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
311
312 TP_ARGS(name, state, cpu_id)
313 )
314
315 /*
316 * The power domain events are used for power domains transitions
317 */
318 DECLARE_EVENT_CLASS(power_domain,
319
320 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
321
322 TP_ARGS(name, state, cpu_id),
323
324 TP_STRUCT__entry(
325 __string( name, name )
326 __field( u64, state )
327 __field( u64, cpu_id )
328 ),
329
330 TP_fast_assign(
331 tp_strcpy(name, name)
332 tp_assign(state, state)
333 tp_assign(cpu_id, cpu_id)
334 ),
335
336 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
337 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
338 )
339
340 DEFINE_EVENT(power_domain, power_domain_target,
341
342 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
343
344 TP_ARGS(name, state, cpu_id)
345 )
346 #endif
347
348 #endif /* _TRACE_POWER_H */
349
350 /* This part must be outside protection */
351 #include "../../../probes/define_trace.h"
This page took 0.041444 seconds and 5 git commands to generate.