xref: /openbmc/linux/include/trace/events/devfreq.h (revision 3fc41476)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM devfreq
4 
5 #if !defined(_TRACE_DEVFREQ_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_DEVFREQ_H
7 
8 #include <linux/devfreq.h>
9 #include <linux/tracepoint.h>
10 
11 TRACE_EVENT(devfreq_monitor,
12 	TP_PROTO(struct devfreq *devfreq),
13 
14 	TP_ARGS(devfreq),
15 
16 	TP_STRUCT__entry(
17 		__field(unsigned long, freq)
18 		__field(unsigned long, busy_time)
19 		__field(unsigned long, total_time)
20 		__field(unsigned int, polling_ms)
21 		__string(dev_name, dev_name(&devfreq->dev))
22 	),
23 
24 	TP_fast_assign(
25 		__entry->freq = devfreq->previous_freq;
26 		__entry->busy_time = devfreq->last_status.busy_time;
27 		__entry->total_time = devfreq->last_status.total_time;
28 		__entry->polling_ms = devfreq->profile->polling_ms;
29 		__assign_str(dev_name, dev_name(&devfreq->dev));
30 	),
31 
32 	TP_printk("dev_name=%s freq=%lu polling_ms=%u load=%lu",
33 		__get_str(dev_name), __entry->freq, __entry->polling_ms,
34 		__entry->total_time == 0 ? 0 :
35 			(100 * __entry->busy_time) / __entry->total_time)
36 );
37 #endif /* _TRACE_DEVFREQ_H */
38 
39 /* This part must be outside protection */
40 #include <trace/define_trace.h>
41