Commit | Line | Data |
---|---|---|
100a8fdb PA |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM thermal | |
3 | ||
4 | #if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ) | |
5 | #define _TRACE_THERMAL_H | |
6 | ||
9876b1a4 | 7 | #include <linux/devfreq.h> |
100a8fdb PA |
8 | #include <linux/thermal.h> |
9 | #include <linux/tracepoint.h> | |
10 | ||
d0b45880 MDG |
11 | TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL); |
12 | TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT); | |
13 | TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE); | |
14 | TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE); | |
15 | ||
16 | #define show_tzt_type(type) \ | |
17 | __print_symbolic(type, \ | |
18 | { THERMAL_TRIP_CRITICAL, "CRITICAL"}, \ | |
19 | { THERMAL_TRIP_HOT, "HOT"}, \ | |
20 | { THERMAL_TRIP_PASSIVE, "PASSIVE"}, \ | |
21 | { THERMAL_TRIP_ACTIVE, "ACTIVE"}) | |
22 | ||
100a8fdb PA |
23 | TRACE_EVENT(thermal_temperature, |
24 | ||
25 | TP_PROTO(struct thermal_zone_device *tz), | |
26 | ||
27 | TP_ARGS(tz), | |
28 | ||
29 | TP_STRUCT__entry( | |
30 | __string(thermal_zone, tz->type) | |
31 | __field(int, id) | |
32 | __field(int, temp_prev) | |
33 | __field(int, temp) | |
34 | ), | |
35 | ||
36 | TP_fast_assign( | |
37 | __assign_str(thermal_zone, tz->type); | |
38 | __entry->id = tz->id; | |
39 | __entry->temp_prev = tz->last_temperature; | |
40 | __entry->temp = tz->temperature; | |
41 | ), | |
42 | ||
43 | TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d", | |
44 | __get_str(thermal_zone), __entry->id, __entry->temp_prev, | |
45 | __entry->temp) | |
46 | ); | |
47 | ||
39811569 PA |
48 | TRACE_EVENT(cdev_update, |
49 | ||
50 | TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target), | |
51 | ||
52 | TP_ARGS(cdev, target), | |
53 | ||
54 | TP_STRUCT__entry( | |
55 | __string(type, cdev->type) | |
56 | __field(unsigned long, target) | |
57 | ), | |
58 | ||
59 | TP_fast_assign( | |
60 | __assign_str(type, cdev->type); | |
61 | __entry->target = target; | |
62 | ), | |
63 | ||
64 | TP_printk("type=%s target=%lu", __get_str(type), __entry->target) | |
65 | ); | |
66 | ||
208cd822 PA |
67 | TRACE_EVENT(thermal_zone_trip, |
68 | ||
69 | TP_PROTO(struct thermal_zone_device *tz, int trip, | |
70 | enum thermal_trip_type trip_type), | |
71 | ||
72 | TP_ARGS(tz, trip, trip_type), | |
73 | ||
74 | TP_STRUCT__entry( | |
75 | __string(thermal_zone, tz->type) | |
76 | __field(int, id) | |
77 | __field(int, trip) | |
78 | __field(enum thermal_trip_type, trip_type) | |
79 | ), | |
80 | ||
81 | TP_fast_assign( | |
82 | __assign_str(thermal_zone, tz->type); | |
83 | __entry->id = tz->id; | |
84 | __entry->trip = trip; | |
85 | __entry->trip_type = trip_type; | |
86 | ), | |
87 | ||
d0b45880 | 88 | TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%s", |
208cd822 | 89 | __get_str(thermal_zone), __entry->id, __entry->trip, |
d0b45880 | 90 | show_tzt_type(__entry->trip_type)) |
208cd822 PA |
91 | ); |
92 | ||
6828a471 JM |
93 | TRACE_EVENT(thermal_power_cpu_get_power, |
94 | TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load, | |
95 | size_t load_len, u32 dynamic_power, u32 static_power), | |
96 | ||
97 | TP_ARGS(cpus, freq, load, load_len, dynamic_power, static_power), | |
98 | ||
99 | TP_STRUCT__entry( | |
100 | __bitmask(cpumask, num_possible_cpus()) | |
101 | __field(unsigned long, freq ) | |
102 | __dynamic_array(u32, load, load_len) | |
103 | __field(size_t, load_len ) | |
104 | __field(u32, dynamic_power ) | |
105 | __field(u32, static_power ) | |
106 | ), | |
107 | ||
108 | TP_fast_assign( | |
109 | __assign_bitmask(cpumask, cpumask_bits(cpus), | |
110 | num_possible_cpus()); | |
111 | __entry->freq = freq; | |
112 | memcpy(__get_dynamic_array(load), load, | |
113 | load_len * sizeof(*load)); | |
114 | __entry->load_len = load_len; | |
115 | __entry->dynamic_power = dynamic_power; | |
116 | __entry->static_power = static_power; | |
117 | ), | |
118 | ||
119 | TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d static_power=%d", | |
120 | __get_bitmask(cpumask), __entry->freq, | |
121 | __print_array(__get_dynamic_array(load), __entry->load_len, 4), | |
122 | __entry->dynamic_power, __entry->static_power) | |
123 | ); | |
124 | ||
125 | TRACE_EVENT(thermal_power_cpu_limit, | |
126 | TP_PROTO(const struct cpumask *cpus, unsigned int freq, | |
127 | unsigned long cdev_state, u32 power), | |
128 | ||
129 | TP_ARGS(cpus, freq, cdev_state, power), | |
130 | ||
131 | TP_STRUCT__entry( | |
132 | __bitmask(cpumask, num_possible_cpus()) | |
133 | __field(unsigned int, freq ) | |
134 | __field(unsigned long, cdev_state) | |
135 | __field(u32, power ) | |
136 | ), | |
137 | ||
138 | TP_fast_assign( | |
139 | __assign_bitmask(cpumask, cpumask_bits(cpus), | |
140 | num_possible_cpus()); | |
141 | __entry->freq = freq; | |
142 | __entry->cdev_state = cdev_state; | |
143 | __entry->power = power; | |
144 | ), | |
145 | ||
146 | TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u", | |
147 | __get_bitmask(cpumask), __entry->freq, __entry->cdev_state, | |
148 | __entry->power) | |
149 | ); | |
150 | ||
9876b1a4 JM |
151 | TRACE_EVENT(thermal_power_devfreq_get_power, |
152 | TP_PROTO(struct thermal_cooling_device *cdev, | |
153 | struct devfreq_dev_status *status, unsigned long freq, | |
154 | u32 dynamic_power, u32 static_power), | |
155 | ||
156 | TP_ARGS(cdev, status, freq, dynamic_power, static_power), | |
157 | ||
158 | TP_STRUCT__entry( | |
159 | __string(type, cdev->type ) | |
160 | __field(unsigned long, freq ) | |
161 | __field(u32, load ) | |
162 | __field(u32, dynamic_power ) | |
163 | __field(u32, static_power ) | |
164 | ), | |
165 | ||
166 | TP_fast_assign( | |
167 | __assign_str(type, cdev->type); | |
168 | __entry->freq = freq; | |
169 | __entry->load = (100 * status->busy_time) / status->total_time; | |
170 | __entry->dynamic_power = dynamic_power; | |
171 | __entry->static_power = static_power; | |
172 | ), | |
173 | ||
174 | TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u", | |
175 | __get_str(type), __entry->freq, | |
176 | __entry->load, __entry->dynamic_power, __entry->static_power) | |
177 | ); | |
178 | ||
179 | TRACE_EVENT(thermal_power_devfreq_limit, | |
180 | TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq, | |
181 | unsigned long cdev_state, u32 power), | |
182 | ||
183 | TP_ARGS(cdev, freq, cdev_state, power), | |
184 | ||
185 | TP_STRUCT__entry( | |
186 | __string(type, cdev->type) | |
187 | __field(unsigned int, freq ) | |
188 | __field(unsigned long, cdev_state) | |
189 | __field(u32, power ) | |
190 | ), | |
191 | ||
192 | TP_fast_assign( | |
193 | __assign_str(type, cdev->type); | |
194 | __entry->freq = freq; | |
195 | __entry->cdev_state = cdev_state; | |
196 | __entry->power = power; | |
197 | ), | |
198 | ||
199 | TP_printk("type=%s freq=%u cdev_state=%lu power=%u", | |
200 | __get_str(type), __entry->freq, __entry->cdev_state, | |
201 | __entry->power) | |
202 | ); | |
100a8fdb PA |
203 | #endif /* _TRACE_THERMAL_H */ |
204 | ||
205 | /* This part must be outside protection */ | |
206 | #include <trace/define_trace.h> |