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 | |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 68 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED |
| 69 | |
Jean Pihet | 74704ac | 2010-09-07 09:21:32 +0200 | [diff] [blame] | 70 | /* |
| 71 | * The power events are used for cpuidle & suspend (power_start, power_end) |
| 72 | * and for cpufreq (power_frequency) |
| 73 | */ |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 74 | DECLARE_EVENT_CLASS(power, |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 75 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 76 | 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] | 77 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 78 | TP_ARGS(type, state, cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 79 | |
| 80 | TP_STRUCT__entry( |
| 81 | __field( u64, type ) |
| 82 | __field( u64, state ) |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 83 | __field( u64, cpu_id ) |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 84 | ), |
| 85 | |
| 86 | TP_fast_assign( |
| 87 | __entry->type = type; |
| 88 | __entry->state = state; |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 89 | __entry->cpu_id = cpu_id; |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 90 | ), |
| 91 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 92 | 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 Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 94 | ); |
| 95 | |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 96 | DEFINE_EVENT(power, power_start, |
| 97 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 98 | TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id), |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 99 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 100 | TP_ARGS(type, state, cpu_id) |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 101 | ); |
| 102 | |
| 103 | DEFINE_EVENT(power, power_frequency, |
| 104 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 105 | TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id), |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 106 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 107 | TP_ARGS(type, state, cpu_id) |
Li Zefan | 7703466 | 2009-11-26 15:05:38 +0800 | [diff] [blame] | 108 | ); |
| 109 | |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 110 | TRACE_EVENT(power_end, |
| 111 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 112 | TP_PROTO(unsigned int cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 113 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 114 | TP_ARGS(cpu_id), |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 115 | |
| 116 | TP_STRUCT__entry( |
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( |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 121 | __entry->cpu_id = cpu_id; |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 122 | ), |
| 123 | |
Thomas Renninger | 4c21adf | 2010-07-20 16:59:34 -0700 | [diff] [blame] | 124 | TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id) |
Arjan van de Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 125 | |
| 126 | ); |
| 127 | |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 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 |
| 131 | |
| 132 | enum { |
| 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 |
| 143 | enum { |
| 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 */ |
| 151 | static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; |
| 152 | static inline void trace_power_end(u64 cpuid) {}; |
Steven Rostedt | 4845465 | 2012-02-07 09:40:30 -0500 | [diff] [blame] | 153 | static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {}; |
| 154 | static inline void trace_power_end_rcuidle(u64 cpuid) {}; |
Thomas Renninger | 25e4193 | 2011-01-03 17:50:44 +0100 | [diff] [blame] | 155 | static 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 Pihet | 74704ac | 2010-09-07 09:21:32 +0200 | [diff] [blame] | 160 | /* |
| 161 | * The clock events are used for clock enable/disable and for |
| 162 | * clock rate change |
| 163 | */ |
| 164 | DECLARE_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 | |
| 186 | DEFINE_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 | |
| 193 | DEFINE_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 | |
| 200 | DEFINE_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 | */ |
| 210 | DECLARE_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 | |
| 232 | DEFINE_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 Ven | 6161352 | 2009-09-17 16:11:28 +0200 | [diff] [blame] | 238 | #endif /* _TRACE_POWER_H */ |
| 239 | |
| 240 | /* This part must be outside protection */ |
| 241 | #include <trace/define_trace.h> |