diff options
Diffstat (limited to 'include/trace/events/power.h')
-rw-r--r-- | include/trace/events/power.h | 98 |
1 files changed, 89 insertions, 9 deletions
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 286784d69b8f..1bcc2a8c00e2 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
@@ -7,16 +7,67 @@ | |||
7 | #include <linux/ktime.h> | 7 | #include <linux/ktime.h> |
8 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
9 | 9 | ||
10 | #ifndef _TRACE_POWER_ENUM_ | 10 | DECLARE_EVENT_CLASS(cpu, |
11 | #define _TRACE_POWER_ENUM_ | 11 | |
12 | enum { | 12 | TP_PROTO(unsigned int state, unsigned int cpu_id), |
13 | POWER_NONE = 0, | 13 | |
14 | POWER_CSTATE = 1, /* C-State */ | 14 | TP_ARGS(state, cpu_id), |
15 | POWER_PSTATE = 2, /* Fequency change or DVFS */ | 15 | |
16 | POWER_SSTATE = 3, /* Suspend */ | 16 | TP_STRUCT__entry( |
17 | }; | 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 | ||
18 | #endif | 42 | #endif |
19 | 43 | ||
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 | |||
68 | /* This code will be removed after deprecation time exceeded (2.6.41) */ | ||
69 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED | ||
70 | |||
20 | /* | 71 | /* |
21 | * The power events are used for cpuidle & suspend (power_start, power_end) | 72 | * The power events are used for cpuidle & suspend (power_start, power_end) |
22 | * and for cpufreq (power_frequency) | 73 | * and for cpufreq (power_frequency) |
@@ -75,6 +126,36 @@ TRACE_EVENT(power_end, | |||
75 | 126 | ||
76 | ); | 127 | ); |
77 | 128 | ||
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 | ||
132 | |||
133 | enum { | ||
134 | POWER_NONE = 0, | ||
135 | POWER_CSTATE = 1, | ||
136 | POWER_PSTATE = 2, | ||
137 | }; | ||
138 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ | ||
139 | |||
140 | #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */ | ||
141 | |||
142 | #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED | ||
143 | #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED | ||
144 | enum { | ||
145 | POWER_NONE = 0, | ||
146 | POWER_CSTATE = 1, | ||
147 | POWER_PSTATE = 2, | ||
148 | }; | ||
149 | |||
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 */ | ||
156 | |||
157 | #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */ | ||
158 | |||
78 | /* | 159 | /* |
79 | * The clock events are used for clock enable/disable and for | 160 | * The clock events are used for clock enable/disable and for |
80 | * clock rate change | 161 | * clock rate change |
@@ -153,7 +234,6 @@ DEFINE_EVENT(power_domain, power_domain_target, | |||
153 | 234 | ||
154 | TP_ARGS(name, state, cpu_id) | 235 | TP_ARGS(name, state, cpu_id) |
155 | ); | 236 | ); |
156 | |||
157 | #endif /* _TRACE_POWER_H */ | 237 | #endif /* _TRACE_POWER_H */ |
158 | 238 | ||
159 | /* This part must be outside protection */ | 239 | /* This part must be outside protection */ |