blob: cae9a94f025d95ab1a6f4d927e2459d337280d23 [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
Thomas Renninger25e41932011-01-03 17:50:44 +010068#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
69
Jean Pihet74704ac2010-09-07 09:21:32 +020070/*
71 * The power events are used for cpuidle & suspend (power_start, power_end)
72 * and for cpufreq (power_frequency)
73 */
Li Zefan77034662009-11-26 15:05:38 +080074DECLARE_EVENT_CLASS(power,
Arjan van de Ven61613522009-09-17 16:11:28 +020075
Thomas Renninger4c21adf2010-07-20 16:59:34 -070076 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +020077
Thomas Renninger4c21adf2010-07-20 16:59:34 -070078 TP_ARGS(type, state, cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +020079
80 TP_STRUCT__entry(
81 __field( u64, type )
82 __field( u64, state )
Thomas Renninger4c21adf2010-07-20 16:59:34 -070083 __field( u64, cpu_id )
Arjan van de Ven61613522009-09-17 16:11:28 +020084 ),
85
86 TP_fast_assign(
87 __entry->type = type;
88 __entry->state = state;
Thomas Renninger4c21adf2010-07-20 16:59:34 -070089 __entry->cpu_id = cpu_id;
Arjan van de Ven61613522009-09-17 16:11:28 +020090 ),
91
Thomas Renninger4c21adf2010-07-20 16:59:34 -070092 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
93 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
Arjan van de Ven61613522009-09-17 16:11:28 +020094);
95
Li Zefan77034662009-11-26 15:05:38 +080096DEFINE_EVENT(power, power_start,
97
Thomas Renninger4c21adf2010-07-20 16:59:34 -070098 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
Li Zefan77034662009-11-26 15:05:38 +080099
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700100 TP_ARGS(type, state, cpu_id)
Li Zefan77034662009-11-26 15:05:38 +0800101);
102
103DEFINE_EVENT(power, power_frequency,
104
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700105 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
Li Zefan77034662009-11-26 15:05:38 +0800106
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700107 TP_ARGS(type, state, cpu_id)
Li Zefan77034662009-11-26 15:05:38 +0800108);
109
Arjan van de Ven61613522009-09-17 16:11:28 +0200110TRACE_EVENT(power_end,
111
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700112 TP_PROTO(unsigned int cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +0200113
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700114 TP_ARGS(cpu_id),
Arjan van de Ven61613522009-09-17 16:11:28 +0200115
116 TP_STRUCT__entry(
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700117 __field( u64, cpu_id )
Arjan van de Ven61613522009-09-17 16:11:28 +0200118 ),
119
120 TP_fast_assign(
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700121 __entry->cpu_id = cpu_id;
Arjan van de Ven61613522009-09-17 16:11:28 +0200122 ),
123
Thomas Renninger4c21adf2010-07-20 16:59:34 -0700124 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
Arjan van de Ven61613522009-09-17 16:11:28 +0200125
126);
127
Thomas Renninger25e41932011-01-03 17:50:44 +0100128/* Deprecated dummy functions must be protected against multi-declartion */
129#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
130#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
131
132enum {
133 POWER_NONE = 0,
134 POWER_CSTATE = 1,
135 POWER_PSTATE = 2,
136};
137#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
138
139#else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
140
141#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
142#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
143enum {
144 POWER_NONE = 0,
145 POWER_CSTATE = 1,
146 POWER_PSTATE = 2,
147};
148
149/* These dummy declaration have to be ripped out when the deprecated
150 events get removed */
151static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
152static inline void trace_power_end(u64 cpuid) {};
Steven Rostedt48454652012-02-07 09:40:30 -0500153static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
154static inline void trace_power_end_rcuidle(u64 cpuid) {};
Thomas Renninger25e41932011-01-03 17:50:44 +0100155static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
156#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
157
158#endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
159
Jean Pihet74704ac2010-09-07 09:21:32 +0200160/*
161 * The clock events are used for clock enable/disable and for
162 * clock rate change
163 */
164DECLARE_EVENT_CLASS(clock,
165
166 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
167
168 TP_ARGS(name, state, cpu_id),
169
170 TP_STRUCT__entry(
171 __string( name, name )
172 __field( u64, state )
173 __field( u64, cpu_id )
174 ),
175
176 TP_fast_assign(
177 __assign_str(name, name);
178 __entry->state = state;
179 __entry->cpu_id = cpu_id;
180 ),
181
182 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
183 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
184);
185
186DEFINE_EVENT(clock, clock_enable,
187
188 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
189
190 TP_ARGS(name, state, cpu_id)
191);
192
193DEFINE_EVENT(clock, clock_disable,
194
195 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
196
197 TP_ARGS(name, state, cpu_id)
198);
199
200DEFINE_EVENT(clock, clock_set_rate,
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/*
208 * The power domain events are used for power domains transitions
209 */
210DECLARE_EVENT_CLASS(power_domain,
211
212 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
213
214 TP_ARGS(name, state, cpu_id),
215
216 TP_STRUCT__entry(
217 __string( name, name )
218 __field( u64, state )
219 __field( u64, cpu_id )
220 ),
221
222 TP_fast_assign(
223 __assign_str(name, name);
224 __entry->state = state;
225 __entry->cpu_id = cpu_id;
226),
227
228 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
229 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
230);
231
232DEFINE_EVENT(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);
Arjan van de Ven61613522009-09-17 16:11:28 +0200238#endif /* _TRACE_POWER_H */
239
240/* This part must be outside protection */
241#include <trace/define_trace.h>