blob: 14b38940062b36b79dacc434f19ad8a43b8133e5 [file] [log] [blame]
Arjan van de Ven61613522009-09-17 16:11:28 +02001#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
Thomas Renninger25e41932011-01-03 17:50:44 +010010DECLARE_EVENT_CLASS(cpu,
11
12 TP_PROTO(unsigned int state, unsigned int cpu_id),
13
14 TP_ARGS(state, cpu_id),
15
16 TP_STRUCT__entry(
17 __field( u32, state )
18 __field( u32, cpu_id )
19 ),
20
21 TP_fast_assign(
22 __entry->state = state;
23 __entry->cpu_id = cpu_id;
24 ),
25
26 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
27 (unsigned long)__entry->cpu_id)
28);
29
30DEFINE_EVENT(cpu, cpu_idle,
31
32 TP_PROTO(unsigned int state, unsigned int cpu_id),
33
34 TP_ARGS(state, cpu_id)
35);
36
37/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
38#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
39#define _PWR_EVENT_AVOID_DOUBLE_DEFINING
40
41#define PWR_EVENT_EXIT -1
Arjan van de Ven61613522009-09-17 16:11:28 +020042#endif
43
Thomas Renninger25e41932011-01-03 17:50:44 +010044DEFINE_EVENT(cpu, cpu_frequency,
45
46 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
47
48 TP_ARGS(frequency, cpu_id)
49);
50
51TRACE_EVENT(machine_suspend,
52
53 TP_PROTO(unsigned int state),
54
55 TP_ARGS(state),
56
57 TP_STRUCT__entry(
58 __field( u32, state )
59 ),
60
61 TP_fast_assign(
62 __entry->state = state;
63 ),
64
65 TP_printk("state=%lu", (unsigned long)__entry->state)
66);
67
68/* This code will be removed after deprecation time exceeded (2.6.41) */
69#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
70
Jean Pihet74704ac2010-09-07 09:21:32 +020071/*
72 * The power events are used for cpuidle & suspend (power_start, power_end)
73 * and for cpufreq (power_frequency)
74 */
Li Zefan77034662009-11-26 15:05:38 +080075DECLARE_EVENT_CLASS(power,
Arjan van de Ven61613522009-09-17 16:11:28 +020076
Thomas Renninger4c21adf2010-07-20 16:59:34 -070077 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +020078
Thomas Renninger4c21adf2010-07-20 16:59:34 -070079 TP_ARGS(type, state, cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +020080
81 TP_STRUCT__entry(
82 __field( u64, type )
83 __field( u64, state )
Thomas Renninger4c21adf2010-07-20 16:59:34 -070084 __field( u64, cpu_id )
Arjan van de Ven61613522009-09-17 16:11:28 +020085 ),
86
87 TP_fast_assign(
88 __entry->type = type;
89 __entry->state = state;
Thomas Renninger4c21adf2010-07-20 16:59:34 -070090 __entry->cpu_id = cpu_id;
Arjan van de Ven61613522009-09-17 16:11:28 +020091 ),
92
Thomas Renninger4c21adf2010-07-20 16:59:34 -070093 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
94 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
Arjan van de Ven61613522009-09-17 16:11:28 +020095);
96
Li Zefan77034662009-11-26 15:05:38 +080097DEFINE_EVENT(power, power_start,
98
Thomas Renninger4c21adf2010-07-20 16:59:34 -070099 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
Li Zefan77034662009-11-26 15:05:38 +0800100
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700101 TP_ARGS(type, state, cpu_id)
Li Zefan77034662009-11-26 15:05:38 +0800102);
103
104DEFINE_EVENT(power, power_frequency,
105
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700106 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
Li Zefan77034662009-11-26 15:05:38 +0800107
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700108 TP_ARGS(type, state, cpu_id)
Li Zefan77034662009-11-26 15:05:38 +0800109);
110
Arjan van de Ven61613522009-09-17 16:11:28 +0200111TRACE_EVENT(power_end,
112
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700113 TP_PROTO(unsigned int cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +0200114
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700115 TP_ARGS(cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +0200116
117 TP_STRUCT__entry(
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700118 __field( u64, cpu_id )
Arjan van de Ven61613522009-09-17 16:11:28 +0200119 ),
120
121 TP_fast_assign(
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700122 __entry->cpu_id = cpu_id;
Arjan van de Ven61613522009-09-17 16:11:28 +0200123 ),
124
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700125 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
Arjan van de Ven61613522009-09-17 16:11:28 +0200126
127);
128
Thomas Renninger25e41932011-01-03 17:50:44 +0100129/* Deprecated dummy functions must be protected against multi-declartion */
130#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
131#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
132
133enum {
134 POWER_NONE = 0,
135 POWER_CSTATE = 1,
136 POWER_PSTATE = 2,
137};
138#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
139
140#else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
141
142#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
143#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
144enum {
145 POWER_NONE = 0,
146 POWER_CSTATE = 1,
147 POWER_PSTATE = 2,
148};
149
150/* These dummy declaration have to be ripped out when the deprecated
151 events get removed */
152static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
153static inline void trace_power_end(u64 cpuid) {};
Steven Rostedt48454652012-02-07 09:40:30 -0500154static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
155static inline void trace_power_end_rcuidle(u64 cpuid) {};
Thomas Renninger25e41932011-01-03 17:50:44 +0100156static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
157#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
158
159#endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
160
Jean Pihet74704ac2010-09-07 09:21:32 +0200161/*
162 * The clock events are used for clock enable/disable and for
163 * clock rate change
164 */
165DECLARE_EVENT_CLASS(clock,
166
167 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
168
169 TP_ARGS(name, state, cpu_id),
170
171 TP_STRUCT__entry(
172 __string( name, name )
173 __field( u64, state )
174 __field( u64, cpu_id )
175 ),
176
177 TP_fast_assign(
178 __assign_str(name, name);
179 __entry->state = state;
180 __entry->cpu_id = cpu_id;
181 ),
182
183 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
184 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
185);
186
187DEFINE_EVENT(clock, clock_enable,
188
189 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
190
191 TP_ARGS(name, state, cpu_id)
192);
193
194DEFINE_EVENT(clock, clock_disable,
195
196 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
197
198 TP_ARGS(name, state, cpu_id)
199);
200
201DEFINE_EVENT(clock, clock_set_rate,
202
203 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
204
205 TP_ARGS(name, state, cpu_id)
206);
207
208/*
209 * The power domain events are used for power domains transitions
210 */
211DECLARE_EVENT_CLASS(power_domain,
212
213 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
214
215 TP_ARGS(name, state, cpu_id),
216
217 TP_STRUCT__entry(
218 __string( name, name )
219 __field( u64, state )
220 __field( u64, cpu_id )
221 ),
222
223 TP_fast_assign(
224 __assign_str(name, name);
225 __entry->state = state;
226 __entry->cpu_id = cpu_id;
227),
228
229 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
230 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
231);
232
233DEFINE_EVENT(power_domain, power_domain_target,
234
235 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
236
237 TP_ARGS(name, state, cpu_id)
238);
Arjan van de Ven61613522009-09-17 16:11:28 +0200239#endif /* _TRACE_POWER_H */
240
241/* This part must be outside protection */
242#include <trace/define_trace.h>