xref: /linux/drivers/thermal/thermal_trace_ipa.h (revision 32a7a02117de01199ce15ec121ac7af417c340eb)
1*32a7a021SDaniel Lezcano /* SPDX-License-Identifier: GPL-2.0 */
2*32a7a021SDaniel Lezcano #undef TRACE_SYSTEM
3*32a7a021SDaniel Lezcano #define TRACE_SYSTEM thermal_power_allocator
4*32a7a021SDaniel Lezcano 
5*32a7a021SDaniel Lezcano #if !defined(_TRACE_THERMAL_POWER_ALLOCATOR_H) || defined(TRACE_HEADER_MULTI_READ)
6*32a7a021SDaniel Lezcano #define _TRACE_THERMAL_POWER_ALLOCATOR_H
7*32a7a021SDaniel Lezcano 
8*32a7a021SDaniel Lezcano #include <linux/tracepoint.h>
9*32a7a021SDaniel Lezcano 
10*32a7a021SDaniel Lezcano TRACE_EVENT(thermal_power_allocator,
11*32a7a021SDaniel Lezcano 	TP_PROTO(struct thermal_zone_device *tz, u32 *req_power,
12*32a7a021SDaniel Lezcano 		 u32 total_req_power, u32 *granted_power,
13*32a7a021SDaniel Lezcano 		 u32 total_granted_power, size_t num_actors,
14*32a7a021SDaniel Lezcano 		 u32 power_range, u32 max_allocatable_power,
15*32a7a021SDaniel Lezcano 		 int current_temp, s32 delta_temp),
16*32a7a021SDaniel Lezcano 	TP_ARGS(tz, req_power, total_req_power, granted_power,
17*32a7a021SDaniel Lezcano 		total_granted_power, num_actors, power_range,
18*32a7a021SDaniel Lezcano 		max_allocatable_power, current_temp, delta_temp),
19*32a7a021SDaniel Lezcano 	TP_STRUCT__entry(
20*32a7a021SDaniel Lezcano 		__field(int,           tz_id          )
21*32a7a021SDaniel Lezcano 		__dynamic_array(u32,   req_power, num_actors    )
22*32a7a021SDaniel Lezcano 		__field(u32,           total_req_power          )
23*32a7a021SDaniel Lezcano 		__dynamic_array(u32,   granted_power, num_actors)
24*32a7a021SDaniel Lezcano 		__field(u32,           total_granted_power      )
25*32a7a021SDaniel Lezcano 		__field(size_t,        num_actors               )
26*32a7a021SDaniel Lezcano 		__field(u32,           power_range              )
27*32a7a021SDaniel Lezcano 		__field(u32,           max_allocatable_power    )
28*32a7a021SDaniel Lezcano 		__field(int,           current_temp             )
29*32a7a021SDaniel Lezcano 		__field(s32,           delta_temp               )
30*32a7a021SDaniel Lezcano 	),
31*32a7a021SDaniel Lezcano 	TP_fast_assign(
32*32a7a021SDaniel Lezcano 		__entry->tz_id = tz->id;
33*32a7a021SDaniel Lezcano 		memcpy(__get_dynamic_array(req_power), req_power,
34*32a7a021SDaniel Lezcano 			num_actors * sizeof(*req_power));
35*32a7a021SDaniel Lezcano 		__entry->total_req_power = total_req_power;
36*32a7a021SDaniel Lezcano 		memcpy(__get_dynamic_array(granted_power), granted_power,
37*32a7a021SDaniel Lezcano 			num_actors * sizeof(*granted_power));
38*32a7a021SDaniel Lezcano 		__entry->total_granted_power = total_granted_power;
39*32a7a021SDaniel Lezcano 		__entry->num_actors = num_actors;
40*32a7a021SDaniel Lezcano 		__entry->power_range = power_range;
41*32a7a021SDaniel Lezcano 		__entry->max_allocatable_power = max_allocatable_power;
42*32a7a021SDaniel Lezcano 		__entry->current_temp = current_temp;
43*32a7a021SDaniel Lezcano 		__entry->delta_temp = delta_temp;
44*32a7a021SDaniel Lezcano 	),
45*32a7a021SDaniel Lezcano 
46*32a7a021SDaniel Lezcano 	TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d",
47*32a7a021SDaniel Lezcano 		__entry->tz_id,
48*32a7a021SDaniel Lezcano 		__print_array(__get_dynamic_array(req_power),
49*32a7a021SDaniel Lezcano                               __entry->num_actors, 4),
50*32a7a021SDaniel Lezcano 		__entry->total_req_power,
51*32a7a021SDaniel Lezcano 		__print_array(__get_dynamic_array(granted_power),
52*32a7a021SDaniel Lezcano                               __entry->num_actors, 4),
53*32a7a021SDaniel Lezcano 		__entry->total_granted_power, __entry->power_range,
54*32a7a021SDaniel Lezcano 		__entry->max_allocatable_power, __entry->current_temp,
55*32a7a021SDaniel Lezcano 		__entry->delta_temp)
56*32a7a021SDaniel Lezcano );
57*32a7a021SDaniel Lezcano 
58*32a7a021SDaniel Lezcano TRACE_EVENT(thermal_power_allocator_pid,
59*32a7a021SDaniel Lezcano 	TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral,
60*32a7a021SDaniel Lezcano 		 s64 p, s64 i, s64 d, s32 output),
61*32a7a021SDaniel Lezcano 	TP_ARGS(tz, err, err_integral, p, i, d, output),
62*32a7a021SDaniel Lezcano 	TP_STRUCT__entry(
63*32a7a021SDaniel Lezcano 		__field(int, tz_id       )
64*32a7a021SDaniel Lezcano 		__field(s32, err         )
65*32a7a021SDaniel Lezcano 		__field(s32, err_integral)
66*32a7a021SDaniel Lezcano 		__field(s64, p           )
67*32a7a021SDaniel Lezcano 		__field(s64, i           )
68*32a7a021SDaniel Lezcano 		__field(s64, d           )
69*32a7a021SDaniel Lezcano 		__field(s32, output      )
70*32a7a021SDaniel Lezcano 	),
71*32a7a021SDaniel Lezcano 	TP_fast_assign(
72*32a7a021SDaniel Lezcano 		__entry->tz_id = tz->id;
73*32a7a021SDaniel Lezcano 		__entry->err = err;
74*32a7a021SDaniel Lezcano 		__entry->err_integral = err_integral;
75*32a7a021SDaniel Lezcano 		__entry->p = p;
76*32a7a021SDaniel Lezcano 		__entry->i = i;
77*32a7a021SDaniel Lezcano 		__entry->d = d;
78*32a7a021SDaniel Lezcano 		__entry->output = output;
79*32a7a021SDaniel Lezcano 	),
80*32a7a021SDaniel Lezcano 
81*32a7a021SDaniel Lezcano 	TP_printk("thermal_zone_id=%d err=%d err_integral=%d p=%lld i=%lld d=%lld output=%d",
82*32a7a021SDaniel Lezcano 		  __entry->tz_id, __entry->err, __entry->err_integral,
83*32a7a021SDaniel Lezcano 		  __entry->p, __entry->i, __entry->d, __entry->output)
84*32a7a021SDaniel Lezcano );
85*32a7a021SDaniel Lezcano #endif /* _TRACE_THERMAL_POWER_ALLOCATOR_H */
86*32a7a021SDaniel Lezcano 
87*32a7a021SDaniel Lezcano #undef TRACE_INCLUDE_PATH
88*32a7a021SDaniel Lezcano #define TRACE_INCLUDE_PATH .
89*32a7a021SDaniel Lezcano 
90*32a7a021SDaniel Lezcano #undef TRACE_INCLUDE_FILE
91*32a7a021SDaniel Lezcano #define TRACE_INCLUDE_FILE thermal_trace_ipa
92*32a7a021SDaniel Lezcano 
93*32a7a021SDaniel Lezcano /* This part must be outside protection */
94*32a7a021SDaniel Lezcano #include <trace/define_trace.h>
95