2 #define TRACE_SYSTEM power
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/ktime.h>
8 #include <linux/tracepoint.h>
10 DECLARE_EVENT_CLASS(cpu,
12 TP_PROTO(unsigned int state, unsigned int cpu_id),
14 TP_ARGS(state, cpu_id),
18 __field( u32, cpu_id )
22 __entry->state = state;
23 __entry->cpu_id = cpu_id;
26 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
27 (unsigned long)__entry->cpu_id)
30 DEFINE_EVENT(cpu, cpu_idle,
32 TP_PROTO(unsigned int state, unsigned int cpu_id),
34 TP_ARGS(state, cpu_id)
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
41 #define PWR_EVENT_EXIT -1
44 DEFINE_EVENT(cpu, cpu_frequency,
46 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
48 TP_ARGS(frequency, cpu_id)
51 TRACE_EVENT(machine_suspend,
53 TP_PROTO(unsigned int state),
62 __entry->state = state;
65 TP_printk("state=%lu", (unsigned long)__entry->state)
68 /* This code will be removed after deprecation time exceeded (2.6.41) */
69 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
72 * The power events are used for cpuidle & suspend (power_start, power_end)
73 * and for cpufreq (power_frequency)
75 DECLARE_EVENT_CLASS(power,
77 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
79 TP_ARGS(type, state, cpu_id),
84 __field( u64, cpu_id )
89 __entry->state = state;
90 __entry->cpu_id = cpu_id;
93 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
94 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
97 DEFINE_EVENT(power, power_start,
99 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
101 TP_ARGS(type, state, cpu_id)
104 DEFINE_EVENT(power, power_frequency,
106 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
108 TP_ARGS(type, state, cpu_id)
111 TRACE_EVENT(power_end,
113 TP_PROTO(unsigned int cpu_id),
118 __field( u64, cpu_id )
122 __entry->cpu_id = cpu_id;
125 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
129 /* 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
138 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
140 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
142 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
143 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
150 /* These dummy declaration have to be ripped out when the deprecated
151 events get removed */
152 static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
153 static inline void trace_power_end(u64 cpuid) {};
154 static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
155 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
157 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
160 * The clock events are used for clock enable/disable and for
163 DECLARE_EVENT_CLASS(clock,
165 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
167 TP_ARGS(name, state, cpu_id),
170 __string( name, name )
171 __field( u64, state )
172 __field( u64, cpu_id )
176 __assign_str(name, name);
177 __entry->state = state;
178 __entry->cpu_id = cpu_id;
181 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
182 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
185 DEFINE_EVENT(clock, clock_enable,
187 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
189 TP_ARGS(name, state, cpu_id)
192 DEFINE_EVENT(clock, clock_disable,
194 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
196 TP_ARGS(name, state, cpu_id)
199 DEFINE_EVENT(clock, clock_set_rate,
201 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
203 TP_ARGS(name, state, cpu_id)
207 * The power domain events are used for power domains transitions
209 DECLARE_EVENT_CLASS(power_domain,
211 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
213 TP_ARGS(name, state, cpu_id),
216 __string( name, name )
217 __field( u64, state )
218 __field( u64, cpu_id )
222 __assign_str(name, name);
223 __entry->state = state;
224 __entry->cpu_id = cpu_id;
227 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
228 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
231 DEFINE_EVENT(power_domain, power_domain_target,
233 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
235 TP_ARGS(name, state, cpu_id)
237 #endif /* _TRACE_POWER_H */
239 /* This part must be outside protection */
240 #include <trace/define_trace.h>