2 #define TRACE_SYSTEM thermal
4 #if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_THERMAL_H
7 #include <linux/devfreq.h>
8 #include <linux/thermal.h>
9 #include <linux/tracepoint.h>
11 TRACE_EVENT(thermal_temperature
,
13 TP_PROTO(struct thermal_zone_device
*tz
),
18 __string(thermal_zone
, tz
->type
)
20 __field(int, temp_prev
)
25 __assign_str(thermal_zone
, tz
->type
);
27 __entry
->temp_prev
= tz
->last_temperature
;
28 __entry
->temp
= tz
->temperature
;
31 TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
32 __get_str(thermal_zone
), __entry
->id
, __entry
->temp_prev
,
36 TRACE_EVENT(cdev_update
,
38 TP_PROTO(struct thermal_cooling_device
*cdev
, unsigned long target
),
40 TP_ARGS(cdev
, target
),
43 __string(type
, cdev
->type
)
44 __field(unsigned long, target
)
48 __assign_str(type
, cdev
->type
);
49 __entry
->target
= target
;
52 TP_printk("type=%s target=%lu", __get_str(type
), __entry
->target
)
55 TRACE_EVENT(thermal_zone_trip
,
57 TP_PROTO(struct thermal_zone_device
*tz
, int trip
,
58 enum thermal_trip_type trip_type
),
60 TP_ARGS(tz
, trip
, trip_type
),
63 __string(thermal_zone
, tz
->type
)
66 __field(enum thermal_trip_type
, trip_type
)
70 __assign_str(thermal_zone
, tz
->type
);
73 __entry
->trip_type
= trip_type
;
76 TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%d",
77 __get_str(thermal_zone
), __entry
->id
, __entry
->trip
,
81 TRACE_EVENT(thermal_power_cpu_get_power
,
82 TP_PROTO(const struct cpumask
*cpus
, unsigned long freq
, u32
*load
,
83 size_t load_len
, u32 dynamic_power
, u32 static_power
),
85 TP_ARGS(cpus
, freq
, load
, load_len
, dynamic_power
, static_power
),
88 __bitmask(cpumask
, num_possible_cpus())
89 __field(unsigned long, freq
)
90 __dynamic_array(u32
, load
, load_len
)
91 __field(size_t, load_len
)
92 __field(u32
, dynamic_power
)
93 __field(u32
, static_power
)
97 __assign_bitmask(cpumask
, cpumask_bits(cpus
),
100 memcpy(__get_dynamic_array(load
), load
,
101 load_len
* sizeof(*load
));
102 __entry
->load_len
= load_len
;
103 __entry
->dynamic_power
= dynamic_power
;
104 __entry
->static_power
= static_power
;
107 TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d static_power=%d",
108 __get_bitmask(cpumask
), __entry
->freq
,
109 __print_array(__get_dynamic_array(load
), __entry
->load_len
, 4),
110 __entry
->dynamic_power
, __entry
->static_power
)
113 TRACE_EVENT(thermal_power_cpu_limit
,
114 TP_PROTO(const struct cpumask
*cpus
, unsigned int freq
,
115 unsigned long cdev_state
, u32 power
),
117 TP_ARGS(cpus
, freq
, cdev_state
, power
),
120 __bitmask(cpumask
, num_possible_cpus())
121 __field(unsigned int, freq
)
122 __field(unsigned long, cdev_state
)
127 __assign_bitmask(cpumask
, cpumask_bits(cpus
),
128 num_possible_cpus());
129 __entry
->freq
= freq
;
130 __entry
->cdev_state
= cdev_state
;
131 __entry
->power
= power
;
134 TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u",
135 __get_bitmask(cpumask
), __entry
->freq
, __entry
->cdev_state
,
139 TRACE_EVENT(thermal_power_devfreq_get_power
,
140 TP_PROTO(struct thermal_cooling_device
*cdev
,
141 struct devfreq_dev_status
*status
, unsigned long freq
,
142 u32 dynamic_power
, u32 static_power
),
144 TP_ARGS(cdev
, status
, freq
, dynamic_power
, static_power
),
147 __string(type
, cdev
->type
)
148 __field(unsigned long, freq
)
150 __field(u32
, dynamic_power
)
151 __field(u32
, static_power
)
155 __assign_str(type
, cdev
->type
);
156 __entry
->freq
= freq
;
157 __entry
->load
= (100 * status
->busy_time
) / status
->total_time
;
158 __entry
->dynamic_power
= dynamic_power
;
159 __entry
->static_power
= static_power
;
162 TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u",
163 __get_str(type
), __entry
->freq
,
164 __entry
->load
, __entry
->dynamic_power
, __entry
->static_power
)
167 TRACE_EVENT(thermal_power_devfreq_limit
,
168 TP_PROTO(struct thermal_cooling_device
*cdev
, unsigned long freq
,
169 unsigned long cdev_state
, u32 power
),
171 TP_ARGS(cdev
, freq
, cdev_state
, power
),
174 __string(type
, cdev
->type
)
175 __field(unsigned int, freq
)
176 __field(unsigned long, cdev_state
)
181 __assign_str(type
, cdev
->type
);
182 __entry
->freq
= freq
;
183 __entry
->cdev_state
= cdev_state
;
184 __entry
->power
= power
;
187 TP_printk("type=%s freq=%u cdev_state=%lu power=%u",
188 __get_str(type
), __entry
->freq
, __entry
->cdev_state
,
191 #endif /* _TRACE_THERMAL_H */
193 /* This part must be outside protection */
194 #include <trace/define_trace.h>