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 #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
71 * The power events are used for cpuidle & suspend (power_start, power_end)
72 * and for cpufreq (power_frequency)
74 DECLARE_EVENT_CLASS(power,
76 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
78 TP_ARGS(type, state, cpu_id),
83 __field( u64, cpu_id )
88 __entry->state = state;
89 __entry->cpu_id = cpu_id;
92 TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
93 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
96 DEFINE_EVENT(power, power_start,
98 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
100 TP_ARGS(type, state, cpu_id)
103 DEFINE_EVENT(power, power_frequency,
105 TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
107 TP_ARGS(type, state, cpu_id)
110 TRACE_EVENT(power_end,
112 TP_PROTO(unsigned int cpu_id),
117 __field( u64, cpu_id )
121 __entry->cpu_id = cpu_id;
124 TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
128 /* 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
137 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
139 #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
141 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
142 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
149 /* These dummy declaration have to be ripped out when the deprecated
150 events get removed */
151 static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
152 static inline void trace_power_end(u64 cpuid) {};
153 static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
154 static inline void trace_power_end_rcuidle(u64 cpuid) {};
155 static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
156 #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
158 #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
161 * The clock events are used for clock enable/disable and for
164 DECLARE_EVENT_CLASS(clock,
166 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
168 TP_ARGS(name, state, cpu_id),
171 __string( name, name )
172 __field( u64, state )
173 __field( u64, cpu_id )
177 __assign_str(name, name);
178 __entry->state = state;
179 __entry->cpu_id = cpu_id;
182 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
183 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
186 DEFINE_EVENT(clock, clock_enable,
188 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
190 TP_ARGS(name, state, cpu_id)
193 DEFINE_EVENT(clock, clock_disable,
195 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
197 TP_ARGS(name, state, cpu_id)
200 DEFINE_EVENT(clock, clock_set_rate,
202 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
204 TP_ARGS(name, state, cpu_id)
208 * The power domain events are used for power domains transitions
210 DECLARE_EVENT_CLASS(power_domain,
212 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
214 TP_ARGS(name, state, cpu_id),
217 __string( name, name )
218 __field( u64, state )
219 __field( u64, cpu_id )
223 __assign_str(name, name);
224 __entry->state = state;
225 __entry->cpu_id = cpu_id;
228 TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
229 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
232 DEFINE_EVENT(power_domain, power_domain_target,
234 TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
236 TP_ARGS(name, state, cpu_id)
238 #endif /* _TRACE_POWER_H */
240 /* This part must be outside protection */
241 #include <trace/define_trace.h>