Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 1 | #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 Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 10 | DECLARE_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 | |
| 30 | DEFINE_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 Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 42 | #endif |
| 43 | |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 44 | DEFINE_EVENT(cpu, cpu_frequency, |
| 45 | |
| 46 | TP_PROTO(unsigned int frequency, unsigned int cpu_id), |
| 47 | |
| 48 | TP_ARGS(frequency, cpu_id) |
| 49 | ); |
| 50 | |
| 51 | TRACE_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 | |
Arve Hjønnevåg | 6791e36 | 2012-04-29 22:53:02 +0200 | [diff] [blame] | 68 | DECLARE_EVENT_CLASS(wakeup_source, |
| 69 | |
| 70 | TP_PROTO(const char *name, unsigned int state), |
| 71 | |
| 72 | TP_ARGS(name, state), |
| 73 | |
| 74 | TP_STRUCT__entry( |
| 75 | __string( name, name ) |
| 76 | __field( u64, state ) |
| 77 | ), |
| 78 | |
| 79 | TP_fast_assign( |
| 80 | __assign_str(name, name); |
| 81 | __entry->state = state; |
| 82 | ), |
| 83 | |
| 84 | TP_printk("%s state=0x%lx", __get_str(name), |
| 85 | (unsigned long)__entry->state) |
| 86 | ); |
| 87 | |
| 88 | DEFINE_EVENT(wakeup_source, wakeup_source_activate, |
| 89 | |
| 90 | TP_PROTO(const char *name, unsigned int state), |
| 91 | |
| 92 | TP_ARGS(name, state) |
| 93 | ); |
| 94 | |
| 95 | DEFINE_EVENT(wakeup_source, wakeup_source_deactivate, |
| 96 | |
| 97 | TP_PROTO(const char *name, unsigned int state), |
| 98 | |
| 99 | TP_ARGS(name, state) |
| 100 | ); |
| 101 | |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 102 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED |
| 103 | |
Jean Pihet | 74704ac | 2010-09-07 09:21:32 +0200 | [diff] [blame] | 104 | /* |
| 105 | * The power events are used for cpuidle & suspend (power_start, power_end) |
| 106 | * and for cpufreq (power_frequency) |
| 107 | */ |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 108 | DECLARE_EVENT_CLASS(power, |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 109 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 110 | TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 111 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 112 | TP_ARGS(type, state, cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 113 | |
| 114 | TP_STRUCT__entry( |
| 115 | __field( u64, type ) |
| 116 | __field( u64, state ) |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 117 | __field( u64, cpu_id ) |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 118 | ), |
| 119 | |
| 120 | TP_fast_assign( |
| 121 | __entry->type = type; |
| 122 | __entry->state = state; |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 123 | __entry->cpu_id = cpu_id; |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 124 | ), |
| 125 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 126 | TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type, |
| 127 | (unsigned long)__entry->state, (unsigned long)__entry->cpu_id) |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 128 | ); |
| 129 | |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 130 | DEFINE_EVENT(power, power_start, |
| 131 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 132 | TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id), |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 133 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 134 | TP_ARGS(type, state, cpu_id) |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 135 | ); |
| 136 | |
| 137 | DEFINE_EVENT(power, power_frequency, |
| 138 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 139 | TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id), |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 140 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 141 | TP_ARGS(type, state, cpu_id) |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 142 | ); |
| 143 | |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 144 | TRACE_EVENT(power_end, |
| 145 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 146 | TP_PROTO(unsigned int cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 147 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 148 | TP_ARGS(cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 149 | |
| 150 | TP_STRUCT__entry( |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 151 | __field( u64, cpu_id ) |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 152 | ), |
| 153 | |
| 154 | TP_fast_assign( |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 155 | __entry->cpu_id = cpu_id; |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 156 | ), |
| 157 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 158 | TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id) |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 159 | |
| 160 | ); |
| 161 | |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 162 | /* Deprecated dummy functions must be protected against multi-declartion */ |
| 163 | #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED |
| 164 | #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED |
| 165 | |
| 166 | enum { |
| 167 | POWER_NONE = 0, |
| 168 | POWER_CSTATE = 1, |
| 169 | POWER_PSTATE = 2, |
| 170 | }; |
| 171 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ |
| 172 | |
| 173 | #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */ |
| 174 | |
| 175 | #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED |
| 176 | #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED |
| 177 | enum { |
| 178 | POWER_NONE = 0, |
| 179 | POWER_CSTATE = 1, |
| 180 | POWER_PSTATE = 2, |
| 181 | }; |
| 182 | |
| 183 | /* These dummy declaration have to be ripped out when the deprecated |
| 184 | events get removed */ |
| 185 | static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; |
| 186 | static inline void trace_power_end(u64 cpuid) {}; |
Steven Rostedt | 4845465 | 2012-02-07 09:40:30 -0500 | [diff] [blame] | 187 | static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {}; |
| 188 | static inline void trace_power_end_rcuidle(u64 cpuid) {}; |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 189 | static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {}; |
| 190 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ |
| 191 | |
| 192 | #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */ |
| 193 | |
Jean Pihet | 74704ac | 2010-09-07 09:21:32 +0200 | [diff] [blame] | 194 | /* |
| 195 | * The clock events are used for clock enable/disable and for |
| 196 | * clock rate change |
| 197 | */ |
| 198 | DECLARE_EVENT_CLASS(clock, |
| 199 | |
| 200 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 201 | |
| 202 | TP_ARGS(name, state, cpu_id), |
| 203 | |
| 204 | TP_STRUCT__entry( |
| 205 | __string( name, name ) |
| 206 | __field( u64, state ) |
| 207 | __field( u64, cpu_id ) |
| 208 | ), |
| 209 | |
| 210 | TP_fast_assign( |
| 211 | __assign_str(name, name); |
| 212 | __entry->state = state; |
| 213 | __entry->cpu_id = cpu_id; |
| 214 | ), |
| 215 | |
| 216 | TP_printk("%s state=%lu cpu_id=%lu", __get_str(name), |
| 217 | (unsigned long)__entry->state, (unsigned long)__entry->cpu_id) |
| 218 | ); |
| 219 | |
| 220 | DEFINE_EVENT(clock, clock_enable, |
| 221 | |
| 222 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 223 | |
| 224 | TP_ARGS(name, state, cpu_id) |
| 225 | ); |
| 226 | |
| 227 | DEFINE_EVENT(clock, clock_disable, |
| 228 | |
| 229 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 230 | |
| 231 | TP_ARGS(name, state, cpu_id) |
| 232 | ); |
| 233 | |
| 234 | DEFINE_EVENT(clock, clock_set_rate, |
| 235 | |
| 236 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 237 | |
| 238 | TP_ARGS(name, state, cpu_id) |
| 239 | ); |
| 240 | |
| 241 | /* |
| 242 | * The power domain events are used for power domains transitions |
| 243 | */ |
| 244 | DECLARE_EVENT_CLASS(power_domain, |
| 245 | |
| 246 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 247 | |
| 248 | TP_ARGS(name, state, cpu_id), |
| 249 | |
| 250 | TP_STRUCT__entry( |
| 251 | __string( name, name ) |
| 252 | __field( u64, state ) |
| 253 | __field( u64, cpu_id ) |
| 254 | ), |
| 255 | |
| 256 | TP_fast_assign( |
| 257 | __assign_str(name, name); |
| 258 | __entry->state = state; |
| 259 | __entry->cpu_id = cpu_id; |
| 260 | ), |
| 261 | |
| 262 | TP_printk("%s state=%lu cpu_id=%lu", __get_str(name), |
| 263 | (unsigned long)__entry->state, (unsigned long)__entry->cpu_id) |
| 264 | ); |
| 265 | |
| 266 | DEFINE_EVENT(power_domain, power_domain_target, |
| 267 | |
| 268 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 269 | |
| 270 | TP_ARGS(name, state, cpu_id) |
| 271 | ); |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 272 | #endif /* _TRACE_POWER_H */ |
| 273 | |
| 274 | /* This part must be outside protection */ |
| 275 | #include <trace/define_trace.h> |