Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / trace / events / devfreq.h
blob6cbc4d59fd96b3b2d372db4ef920c2b0bfea189c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
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),
17 TP_STRUCT__entry(
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)
25 TP_fast_assign(
26 __assign_str(dev_name);
27 __entry->freq = freq;
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),
42 TP_ARGS(devfreq),
44 TP_STRUCT__entry(
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))
52 TP_fast_assign(
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>