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_frequency, 12 TP_PROTO(struct devfreq *devfreq, unsigned long freq, 13 unsigned long prev_freq), 14 15 TP_ARGS(devfreq, freq, prev_freq), 16 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) 23 ), 24 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; 31 ), 32 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) 37 ); 38 39 TRACE_EVENT(devfreq_monitor, 40 TP_PROTO(struct devfreq *devfreq), 41 42 TP_ARGS(devfreq), 43 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)) 50 ), 51 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); 58 ), 59 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) 64 ); 65 #endif /* _TRACE_DEVFREQ_H */ 66 67 /* This part must be outside protection */ 68 #include <trace/define_trace.h> 69