1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM devfreq
5 #if !defined(_TRACE_DEVFREQ_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_DEVFREQ_H
8 #include <linux/devfreq.h>
9 #include <linux/tracepoint.h>
11 TRACE_EVENT(devfreq_frequency
,
12 TP_PROTO(struct devfreq
*devfreq
, unsigned long freq
,
13 unsigned long prev_freq
),
15 TP_ARGS(devfreq
, freq
, prev_freq
),
18 __string(dev_name
, dev_name(&devfreq
->dev
))
19 __field(unsigned long, freq
)
20 __field(unsigned long, prev_freq
)
21 __field(unsigned long, busy_time
)
22 __field(unsigned long, total_time
)
26 __assign_str(dev_name
);
28 __entry
->prev_freq
= prev_freq
;
29 __entry
->busy_time
= devfreq
->last_status
.busy_time
;
30 __entry
->total_time
= devfreq
->last_status
.total_time
;
33 TP_printk("dev_name=%-30s freq=%-12lu prev_freq=%-12lu load=%-2lu",
34 __get_str(dev_name
), __entry
->freq
, __entry
->prev_freq
,
35 __entry
->total_time
== 0 ? 0 :
36 (100 * __entry
->busy_time
) / __entry
->total_time
)
39 TRACE_EVENT(devfreq_monitor
,
40 TP_PROTO(struct devfreq
*devfreq
),
45 __field(unsigned long, freq
)
46 __field(unsigned long, busy_time
)
47 __field(unsigned long, total_time
)
48 __field(unsigned int, polling_ms
)
49 __string(dev_name
, dev_name(&devfreq
->dev
))
53 __entry
->freq
= devfreq
->previous_freq
;
54 __entry
->busy_time
= devfreq
->last_status
.busy_time
;
55 __entry
->total_time
= devfreq
->last_status
.total_time
;
56 __entry
->polling_ms
= devfreq
->profile
->polling_ms
;
57 __assign_str(dev_name
);
60 TP_printk("dev_name=%-30s freq=%-12lu polling_ms=%-3u load=%-2lu",
61 __get_str(dev_name
), __entry
->freq
, __entry
->polling_ms
,
62 __entry
->total_time
== 0 ? 0 :
63 (100 * __entry
->busy_time
) / __entry
->total_time
)
65 #endif /* _TRACE_DEVFREQ_H */
67 /* This part must be outside protection */
68 #include <trace/define_trace.h>