Punit Agrawal | 100a8fd | 2014-07-29 11:50:48 +0100 | [diff] [blame] | 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 | |
Javi Merino | 9876b1a | 2015-09-10 18:09:31 +0100 | [diff] [blame] | 7 | #include <linux/devfreq.h> |
Punit Agrawal | 100a8fd | 2014-07-29 11:50:48 +0100 | [diff] [blame] | 8 | #include <linux/thermal.h> |
| 9 | #include <linux/tracepoint.h> |
| 10 | |
Michele Di Giorgio | d0b4588 | 2016-03-01 17:38:54 +0000 | [diff] [blame] | 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 | |
Punit Agrawal | 100a8fd | 2014-07-29 11:50:48 +0100 | [diff] [blame] | 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 | |
Punit Agrawal | 3981156 | 2014-07-29 11:50:49 +0100 | [diff] [blame] | 48 | TRACE_EVENT(cdev_update, |
| 49 | |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 50 | TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target, |
| 51 | unsigned long min_target), |
Punit Agrawal | 3981156 | 2014-07-29 11:50:49 +0100 | [diff] [blame] | 52 | |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 53 | TP_ARGS(cdev, target, min_target), |
Punit Agrawal | 3981156 | 2014-07-29 11:50:49 +0100 | [diff] [blame] | 54 | |
| 55 | TP_STRUCT__entry( |
| 56 | __string(type, cdev->type) |
| 57 | __field(unsigned long, target) |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 58 | __field(unsigned long, min_target) |
Punit Agrawal | 3981156 | 2014-07-29 11:50:49 +0100 | [diff] [blame] | 59 | ), |
| 60 | |
| 61 | TP_fast_assign( |
| 62 | __assign_str(type, cdev->type); |
| 63 | __entry->target = target; |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 64 | __entry->min_target = min_target; |
Punit Agrawal | 3981156 | 2014-07-29 11:50:49 +0100 | [diff] [blame] | 65 | ), |
| 66 | |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 67 | TP_printk("type=%s target=%lu min_target=%lu", __get_str(type), |
| 68 | __entry->target, __entry->min_target) |
Punit Agrawal | 3981156 | 2014-07-29 11:50:49 +0100 | [diff] [blame] | 69 | ); |
| 70 | |
Punit Agrawal | 208cd82 | 2014-07-29 11:50:50 +0100 | [diff] [blame] | 71 | TRACE_EVENT(thermal_zone_trip, |
| 72 | |
| 73 | TP_PROTO(struct thermal_zone_device *tz, int trip, |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 74 | enum thermal_trip_type trip_type, bool is_trip), |
Punit Agrawal | 208cd82 | 2014-07-29 11:50:50 +0100 | [diff] [blame] | 75 | |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 76 | TP_ARGS(tz, trip, trip_type, is_trip), |
Punit Agrawal | 208cd82 | 2014-07-29 11:50:50 +0100 | [diff] [blame] | 77 | |
| 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 Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 83 | __field(bool, is_trip) |
Punit Agrawal | 208cd82 | 2014-07-29 11:50:50 +0100 | [diff] [blame] | 84 | ), |
| 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 Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 91 | __entry->is_trip = is_trip; |
Punit Agrawal | 208cd82 | 2014-07-29 11:50:50 +0100 | [diff] [blame] | 92 | ), |
| 93 | |
Ram Chandrasekar | 5b1c0d1 | 2017-03-28 11:35:40 -0600 | [diff] [blame] | 94 | 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 Giorgio | d0b4588 | 2016-03-01 17:38:54 +0000 | [diff] [blame] | 98 | show_tzt_type(__entry->trip_type)) |
Punit Agrawal | 208cd82 | 2014-07-29 11:50:50 +0100 | [diff] [blame] | 99 | ); |
| 100 | |
Javi Merino | 6828a47 | 2015-03-02 17:17:20 +0000 | [diff] [blame] | 101 | TRACE_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 | |
| 133 | TRACE_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 Merino | 9876b1a | 2015-09-10 18:09:31 +0100 | [diff] [blame] | 159 | TRACE_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 | |
| 187 | TRACE_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 Agrawal | 100a8fd | 2014-07-29 11:50:48 +0100 | [diff] [blame] | 211 | #endif /* _TRACE_THERMAL_H */ |
| 212 | |
| 213 | /* This part must be outside protection */ |
| 214 | #include <trace/define_trace.h> |