blob: 031ae495ffdbf6954b8a6b1c4a2a24dfd8146ff5 [file] [log] [blame]
Punit Agrawal100a8fd2014-07-29 11:50:48 +01001#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
Javi Merino9876b1a2015-09-10 18:09:31 +01007#include <linux/devfreq.h>
Punit Agrawal100a8fd2014-07-29 11:50:48 +01008#include <linux/thermal.h>
9#include <linux/tracepoint.h>
10
Michele Di Giorgiod0b45882016-03-01 17:38:54 +000011TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL);
12TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT);
13TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE);
14TRACE_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
Punit Agrawal100a8fd2014-07-29 11:50:48 +010023TRACE_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
Punit Agrawal39811562014-07-29 11:50:49 +010048TRACE_EVENT(cdev_update,
49
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060050 TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target,
51 unsigned long min_target),
Punit Agrawal39811562014-07-29 11:50:49 +010052
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060053 TP_ARGS(cdev, target, min_target),
Punit Agrawal39811562014-07-29 11:50:49 +010054
55 TP_STRUCT__entry(
56 __string(type, cdev->type)
57 __field(unsigned long, target)
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060058 __field(unsigned long, min_target)
Punit Agrawal39811562014-07-29 11:50:49 +010059 ),
60
61 TP_fast_assign(
62 __assign_str(type, cdev->type);
63 __entry->target = target;
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060064 __entry->min_target = min_target;
Punit Agrawal39811562014-07-29 11:50:49 +010065 ),
66
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060067 TP_printk("type=%s target=%lu min_target=%lu", __get_str(type),
68 __entry->target, __entry->min_target)
Punit Agrawal39811562014-07-29 11:50:49 +010069);
70
Punit Agrawal208cd822014-07-29 11:50:50 +010071TRACE_EVENT(thermal_zone_trip,
72
73 TP_PROTO(struct thermal_zone_device *tz, int trip,
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060074 enum thermal_trip_type trip_type, bool is_trip),
Punit Agrawal208cd822014-07-29 11:50:50 +010075
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060076 TP_ARGS(tz, trip, trip_type, is_trip),
Punit Agrawal208cd822014-07-29 11:50:50 +010077
78 TP_STRUCT__entry(
79 __string(thermal_zone, tz->type)
80 __field(int, id)
81 __field(int, trip)
82 __field(enum thermal_trip_type, trip_type)
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060083 __field(bool, is_trip)
Punit Agrawal208cd822014-07-29 11:50:50 +010084 ),
85
86 TP_fast_assign(
87 __assign_str(thermal_zone, tz->type);
88 __entry->id = tz->id;
89 __entry->trip = trip;
90 __entry->trip_type = trip_type;
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060091 __entry->is_trip = is_trip;
Punit Agrawal208cd822014-07-29 11:50:50 +010092 ),
93
Ram Chandrasekar5b1c0d12017-03-28 11:35:40 -060094 TP_printk("thermal_zone=%s id=%d %s=%d trip_type=%s",
95 __get_str(thermal_zone), __entry->id,
96 (__entry->is_trip) ? "trip" : "hyst",
97 __entry->trip,
Michele Di Giorgiod0b45882016-03-01 17:38:54 +000098 show_tzt_type(__entry->trip_type))
Punit Agrawal208cd822014-07-29 11:50:50 +010099);
100
Javi Merino6828a472015-03-02 17:17:20 +0000101TRACE_EVENT(thermal_power_cpu_get_power,
102 TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load,
103 size_t load_len, u32 dynamic_power, u32 static_power),
104
105 TP_ARGS(cpus, freq, load, load_len, dynamic_power, static_power),
106
107 TP_STRUCT__entry(
108 __bitmask(cpumask, num_possible_cpus())
109 __field(unsigned long, freq )
110 __dynamic_array(u32, load, load_len)
111 __field(size_t, load_len )
112 __field(u32, dynamic_power )
113 __field(u32, static_power )
114 ),
115
116 TP_fast_assign(
117 __assign_bitmask(cpumask, cpumask_bits(cpus),
118 num_possible_cpus());
119 __entry->freq = freq;
120 memcpy(__get_dynamic_array(load), load,
121 load_len * sizeof(*load));
122 __entry->load_len = load_len;
123 __entry->dynamic_power = dynamic_power;
124 __entry->static_power = static_power;
125 ),
126
127 TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d static_power=%d",
128 __get_bitmask(cpumask), __entry->freq,
129 __print_array(__get_dynamic_array(load), __entry->load_len, 4),
130 __entry->dynamic_power, __entry->static_power)
131);
132
133TRACE_EVENT(thermal_power_cpu_limit,
134 TP_PROTO(const struct cpumask *cpus, unsigned int freq,
135 unsigned long cdev_state, u32 power),
136
137 TP_ARGS(cpus, freq, cdev_state, power),
138
139 TP_STRUCT__entry(
140 __bitmask(cpumask, num_possible_cpus())
141 __field(unsigned int, freq )
142 __field(unsigned long, cdev_state)
143 __field(u32, power )
144 ),
145
146 TP_fast_assign(
147 __assign_bitmask(cpumask, cpumask_bits(cpus),
148 num_possible_cpus());
149 __entry->freq = freq;
150 __entry->cdev_state = cdev_state;
151 __entry->power = power;
152 ),
153
154 TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u",
155 __get_bitmask(cpumask), __entry->freq, __entry->cdev_state,
156 __entry->power)
157);
158
Javi Merino9876b1a2015-09-10 18:09:31 +0100159TRACE_EVENT(thermal_power_devfreq_get_power,
160 TP_PROTO(struct thermal_cooling_device *cdev,
161 struct devfreq_dev_status *status, unsigned long freq,
162 u32 dynamic_power, u32 static_power),
163
164 TP_ARGS(cdev, status, freq, dynamic_power, static_power),
165
166 TP_STRUCT__entry(
167 __string(type, cdev->type )
168 __field(unsigned long, freq )
169 __field(u32, load )
170 __field(u32, dynamic_power )
171 __field(u32, static_power )
172 ),
173
174 TP_fast_assign(
175 __assign_str(type, cdev->type);
176 __entry->freq = freq;
177 __entry->load = (100 * status->busy_time) / status->total_time;
178 __entry->dynamic_power = dynamic_power;
179 __entry->static_power = static_power;
180 ),
181
182 TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u",
183 __get_str(type), __entry->freq,
184 __entry->load, __entry->dynamic_power, __entry->static_power)
185);
186
187TRACE_EVENT(thermal_power_devfreq_limit,
188 TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq,
189 unsigned long cdev_state, u32 power),
190
191 TP_ARGS(cdev, freq, cdev_state, power),
192
193 TP_STRUCT__entry(
194 __string(type, cdev->type)
195 __field(unsigned int, freq )
196 __field(unsigned long, cdev_state)
197 __field(u32, power )
198 ),
199
200 TP_fast_assign(
201 __assign_str(type, cdev->type);
202 __entry->freq = freq;
203 __entry->cdev_state = cdev_state;
204 __entry->power = power;
205 ),
206
207 TP_printk("type=%s freq=%u cdev_state=%lu power=%u",
208 __get_str(type), __entry->freq, __entry->cdev_state,
209 __entry->power)
210);
Punit Agrawal100a8fd2014-07-29 11:50:48 +0100211#endif /* _TRACE_THERMAL_H */
212
213/* This part must be outside protection */
214#include <trace/define_trace.h>