Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM thermal
0004 
0005 #if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_THERMAL_H
0007 
0008 #include <linux/devfreq.h>
0009 #include <linux/thermal.h>
0010 #include <linux/tracepoint.h>
0011 
0012 TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL);
0013 TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT);
0014 TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE);
0015 TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE);
0016 
0017 #define show_tzt_type(type)                 \
0018     __print_symbolic(type,                  \
0019              { THERMAL_TRIP_CRITICAL, "CRITICAL"},  \
0020              { THERMAL_TRIP_HOT,      "HOT"},   \
0021              { THERMAL_TRIP_PASSIVE,  "PASSIVE"},   \
0022              { THERMAL_TRIP_ACTIVE,   "ACTIVE"})
0023 
0024 TRACE_EVENT(thermal_temperature,
0025 
0026     TP_PROTO(struct thermal_zone_device *tz),
0027 
0028     TP_ARGS(tz),
0029 
0030     TP_STRUCT__entry(
0031         __string(thermal_zone, tz->type)
0032         __field(int, id)
0033         __field(int, temp_prev)
0034         __field(int, temp)
0035     ),
0036 
0037     TP_fast_assign(
0038         __assign_str(thermal_zone, tz->type);
0039         __entry->id = tz->id;
0040         __entry->temp_prev = tz->last_temperature;
0041         __entry->temp = tz->temperature;
0042     ),
0043 
0044     TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
0045         __get_str(thermal_zone), __entry->id, __entry->temp_prev,
0046         __entry->temp)
0047 );
0048 
0049 TRACE_EVENT(cdev_update,
0050 
0051     TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target),
0052 
0053     TP_ARGS(cdev, target),
0054 
0055     TP_STRUCT__entry(
0056         __string(type, cdev->type)
0057         __field(unsigned long, target)
0058     ),
0059 
0060     TP_fast_assign(
0061         __assign_str(type, cdev->type);
0062         __entry->target = target;
0063     ),
0064 
0065     TP_printk("type=%s target=%lu", __get_str(type), __entry->target)
0066 );
0067 
0068 TRACE_EVENT(thermal_zone_trip,
0069 
0070     TP_PROTO(struct thermal_zone_device *tz, int trip,
0071         enum thermal_trip_type trip_type),
0072 
0073     TP_ARGS(tz, trip, trip_type),
0074 
0075     TP_STRUCT__entry(
0076         __string(thermal_zone, tz->type)
0077         __field(int, id)
0078         __field(int, trip)
0079         __field(enum thermal_trip_type, trip_type)
0080     ),
0081 
0082     TP_fast_assign(
0083         __assign_str(thermal_zone, tz->type);
0084         __entry->id = tz->id;
0085         __entry->trip = trip;
0086         __entry->trip_type = trip_type;
0087     ),
0088 
0089     TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%s",
0090         __get_str(thermal_zone), __entry->id, __entry->trip,
0091         show_tzt_type(__entry->trip_type))
0092 );
0093 
0094 #ifdef CONFIG_CPU_THERMAL
0095 TRACE_EVENT(thermal_power_cpu_get_power_simple,
0096     TP_PROTO(int cpu, u32 power),
0097 
0098     TP_ARGS(cpu, power),
0099 
0100     TP_STRUCT__entry(
0101         __field(int, cpu)
0102         __field(u32, power)
0103     ),
0104 
0105     TP_fast_assign(
0106         __entry->cpu = cpu;
0107         __entry->power = power;
0108     ),
0109 
0110     TP_printk("cpu=%d power=%u", __entry->cpu, __entry->power)
0111 );
0112 
0113 TRACE_EVENT(thermal_power_cpu_limit,
0114     TP_PROTO(const struct cpumask *cpus, unsigned int freq,
0115         unsigned long cdev_state, u32 power),
0116 
0117     TP_ARGS(cpus, freq, cdev_state, power),
0118 
0119     TP_STRUCT__entry(
0120         __bitmask(cpumask, num_possible_cpus())
0121         __field(unsigned int,  freq      )
0122         __field(unsigned long, cdev_state)
0123         __field(u32,           power     )
0124     ),
0125 
0126     TP_fast_assign(
0127         __assign_bitmask(cpumask, cpumask_bits(cpus),
0128                 num_possible_cpus());
0129         __entry->freq = freq;
0130         __entry->cdev_state = cdev_state;
0131         __entry->power = power;
0132     ),
0133 
0134     TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u",
0135         __get_bitmask(cpumask), __entry->freq, __entry->cdev_state,
0136         __entry->power)
0137 );
0138 #endif /* CONFIG_CPU_THERMAL */
0139 
0140 #ifdef CONFIG_DEVFREQ_THERMAL
0141 TRACE_EVENT(thermal_power_devfreq_get_power,
0142     TP_PROTO(struct thermal_cooling_device *cdev,
0143          struct devfreq_dev_status *status, unsigned long freq,
0144         u32 power),
0145 
0146     TP_ARGS(cdev, status,  freq, power),
0147 
0148     TP_STRUCT__entry(
0149         __string(type,         cdev->type    )
0150         __field(unsigned long, freq          )
0151         __field(u32,           busy_time)
0152         __field(u32,           total_time)
0153         __field(u32,           power)
0154     ),
0155 
0156     TP_fast_assign(
0157         __assign_str(type, cdev->type);
0158         __entry->freq = freq;
0159         __entry->busy_time = status->busy_time;
0160         __entry->total_time = status->total_time;
0161         __entry->power = power;
0162     ),
0163 
0164     TP_printk("type=%s freq=%lu load=%u power=%u",
0165         __get_str(type), __entry->freq,
0166         __entry->total_time == 0 ? 0 :
0167             (100 * __entry->busy_time) / __entry->total_time,
0168         __entry->power)
0169 );
0170 
0171 TRACE_EVENT(thermal_power_devfreq_limit,
0172     TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq,
0173         unsigned long cdev_state, u32 power),
0174 
0175     TP_ARGS(cdev, freq, cdev_state, power),
0176 
0177     TP_STRUCT__entry(
0178         __string(type,         cdev->type)
0179         __field(unsigned int,  freq      )
0180         __field(unsigned long, cdev_state)
0181         __field(u32,           power     )
0182     ),
0183 
0184     TP_fast_assign(
0185         __assign_str(type, cdev->type);
0186         __entry->freq = freq;
0187         __entry->cdev_state = cdev_state;
0188         __entry->power = power;
0189     ),
0190 
0191     TP_printk("type=%s freq=%u cdev_state=%lu power=%u",
0192         __get_str(type), __entry->freq, __entry->cdev_state,
0193         __entry->power)
0194 );
0195 #endif /* CONFIG_DEVFREQ_THERMAL */
0196 #endif /* _TRACE_THERMAL_H */
0197 
0198 /* This part must be outside protection */
0199 #include <trace/define_trace.h>