Fix: update sched instrumentation for kernel 4.12
[lttng-modules.git] / instrumentation / events / lttng-module / power.h
CommitLineData
b283666f
PW
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM power
3
3bc29f0a
MD
4#if !defined(LTTNG_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define LTTNG_TRACE_POWER_H
b283666f 6
6ec43db8 7#include <probes/lttng-tracepoint-event.h>
b283666f 8#include <linux/ktime.h>
7c68b363 9#include <linux/version.h>
b283666f 10
7c68b363 11#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
3bc29f0a 12LTTNG_TRACEPOINT_EVENT_CLASS(power_cpu,
b283666f
PW
13
14 TP_PROTO(unsigned int state, unsigned int cpu_id),
15
16 TP_ARGS(state, cpu_id),
17
f127e61e
MD
18 TP_FIELDS(
19 ctf_integer(u32, state, state)
20 ctf_integer(u32, cpu_id, cpu_id)
21 )
b283666f
PW
22)
23
3bc29f0a 24LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_idle,
9cf29d3e
MD
25
26 power_cpu_idle,
b283666f
PW
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
3bc29f0a 40LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_frequency,
9cf29d3e
MD
41
42 power_cpu_frequency,
b283666f
PW
43
44 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
45
46 TP_ARGS(frequency, cpu_id)
47)
48
3bc29f0a 49LTTNG_TRACEPOINT_EVENT_MAP(machine_suspend,
9cf29d3e
MD
50
51 power_machine_suspend,
b283666f
PW
52
53 TP_PROTO(unsigned int state),
54
55 TP_ARGS(state),
56
f127e61e
MD
57 TP_FIELDS(
58 ctf_integer(u32, state, state)
59 )
b283666f 60)
7c68b363
AG
61#endif
62
63#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
3bc29f0a 64LTTNG_TRACEPOINT_EVENT_CLASS(power_wakeup_source,
7c68b363
AG
65
66 TP_PROTO(const char *name, unsigned int state),
67
68 TP_ARGS(name, state),
69
f127e61e
MD
70 TP_FIELDS(
71 ctf_string(name, name)
72 ctf_integer(u64, state, state)
73 )
7c68b363
AG
74)
75
3bc29f0a 76LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_activate,
9cf29d3e
MD
77
78 power_wakeup_source_activate,
7c68b363
AG
79
80 TP_PROTO(const char *name, unsigned int state),
81
82 TP_ARGS(name, state)
83)
84
3bc29f0a 85LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_deactivate,
9cf29d3e
MD
86
87 power_wakeup_source_deactivate,
7c68b363
AG
88
89 TP_PROTO(const char *name, unsigned int state),
90
91 TP_ARGS(name, state)
92)
93#endif
94
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
99#endif
b283666f 100
b283666f
PW
101#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
102
103/*
104 * The power events are used for cpuidle & suspend (power_start, power_end)
105 * and for cpufreq (power_frequency)
106 */
3bc29f0a 107LTTNG_TRACEPOINT_EVENT_CLASS(power,
b283666f 108
7c68b363 109#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
b283666f
PW
110 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
111
112 TP_ARGS(type, state, cpu_id),
7c68b363
AG
113#else
114 TP_PROTO(unsigned int type, unsigned int state),
115
116 TP_ARGS(type, state),
117#endif
b283666f 118
f127e61e
MD
119 TP_FIELDS(
120 ctf_integer(u64, type, type)
121 ctf_integer(u64, state, state)
7c68b363 122#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
f127e61e 123 ctf_integer(u64, cpu_id, cpu_id)
7c68b363 124#endif
f127e61e 125 )
b283666f
PW
126)
127
3bc29f0a 128LTTNG_TRACEPOINT_EVENT_INSTANCE(power, power_start,
b283666f 129
7c68b363 130#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
b283666f
PW
131 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
132
133 TP_ARGS(type, state, cpu_id)
7c68b363
AG
134#else
135 TP_PROTO(unsigned int type, unsigned int state),
136
137 TP_ARGS(type, state)
138#endif
b283666f
PW
139)
140
3bc29f0a 141LTTNG_TRACEPOINT_EVENT_INSTANCE(power, power_frequency,
b283666f 142
7c68b363 143#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
b283666f
PW
144 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
145
146 TP_ARGS(type, state, cpu_id)
7c68b363
AG
147#else
148 TP_PROTO(unsigned int type, unsigned int state),
149
150 TP_ARGS(type, state)
151#endif
b283666f
PW
152)
153
3bc29f0a 154LTTNG_TRACEPOINT_EVENT(power_end,
b283666f 155
7c68b363 156#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
b283666f
PW
157 TP_PROTO(unsigned int cpu_id),
158
159 TP_ARGS(cpu_id),
7c68b363
AG
160#else
161 TP_PROTO(int dummy),
162
163 TP_ARGS(dummy),
164#endif
b283666f 165
f127e61e 166 TP_FIELDS(
7c68b363 167#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
f127e61e 168 ctf_integer(u64, cpu_id, cpu_id)
7c68b363 169#else
f127e61e 170 ctf_integer(u64, dummy, 0xffff)
7c68b363 171#endif
f127e61e 172 )
b283666f
PW
173)
174
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
178
179enum {
180 POWER_NONE = 0,
181 POWER_CSTATE = 1,
182 POWER_PSTATE = 2,
183};
184#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
185
186#else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
187
188#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
189#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
190enum {
191 POWER_NONE = 0,
192 POWER_CSTATE = 1,
193 POWER_PSTATE = 2,
194};
195
196/* These dummy declaration have to be ripped out when the deprecated
197 events get removed */
198static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
199static inline void trace_power_end(u64 cpuid) {};
7c68b363
AG
200#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
201static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
202static inline void trace_power_end_rcuidle(u64 cpuid) {};
203#endif
b283666f
PW
204static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
205#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
206
207#endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
208
7c68b363 209#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
b283666f
PW
210/*
211 * The clock events are used for clock enable/disable and for
212 * clock rate change
213 */
3bc29f0a 214LTTNG_TRACEPOINT_EVENT_CLASS(power_clock,
b283666f
PW
215
216 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
217
218 TP_ARGS(name, state, cpu_id),
219
f127e61e
MD
220 TP_FIELDS(
221 ctf_string(name, name)
222 ctf_integer(u64, state, state)
223 ctf_integer(u64, cpu_id, cpu_id)
224 )
b283666f
PW
225)
226
3bc29f0a 227LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_enable,
9cf29d3e
MD
228
229 power_clock_enable,
b283666f
PW
230
231 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
232
233 TP_ARGS(name, state, cpu_id)
234)
235
3bc29f0a 236LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_disable,
9cf29d3e
MD
237
238 power_clock_disable,
b283666f
PW
239
240 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
241
242 TP_ARGS(name, state, cpu_id)
243)
244
3bc29f0a 245LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_set_rate,
9cf29d3e
MD
246
247 power_clock_set_rate,
b283666f
PW
248
249 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
250
251 TP_ARGS(name, state, cpu_id)
252)
253
254/*
255 * The power domain events are used for power domains transitions
256 */
3bc29f0a 257LTTNG_TRACEPOINT_EVENT_CLASS(power_domain,
b283666f
PW
258
259 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
260
261 TP_ARGS(name, state, cpu_id),
262
f127e61e
MD
263 TP_FIELDS(
264 ctf_string(name, name)
265 ctf_integer(u64, state, state)
266 ctf_integer(u64, cpu_id, cpu_id)
267 )
b283666f
PW
268)
269
3bc29f0a 270LTTNG_TRACEPOINT_EVENT_INSTANCE(power_domain, power_domain_target,
b283666f
PW
271
272 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
273
274 TP_ARGS(name, state, cpu_id)
275)
7c68b363
AG
276#endif
277
3bc29f0a 278#endif /* LTTNG_TRACE_POWER_H */
b283666f
PW
279
280/* This part must be outside protection */
6ec43db8 281#include <probes/define_trace.h>
This page took 0.040514 seconds and 4 git commands to generate.