1 /* SPDX-License-Identifier: GPL-2.0 */
3 * amd-pstate-trace.h - AMD Processor P-state Frequency Driver Tracer
5 * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
7 * Author: Huang Rui <ray.huang@amd.com>
10 #if !defined(_AMD_PSTATE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _AMD_PSTATE_TRACE_H
13 #include <linux/cpufreq.h>
14 #include <linux/tracepoint.h>
15 #include <linux/trace_events.h>
18 #define TRACE_SYSTEM amd_cpu
20 #undef TRACE_INCLUDE_FILE
21 #define TRACE_INCLUDE_FILE amd-pstate-trace
23 #define TPS(x) tracepoint_string(x)
25 TRACE_EVENT(amd_pstate_perf
,
27 TP_PROTO(unsigned long min_perf
,
28 unsigned long target_perf
,
29 unsigned long capacity
,
52 __field(unsigned long, min_perf
)
53 __field(unsigned long, target_perf
)
54 __field(unsigned long, capacity
)
55 __field(unsigned long long, freq
)
56 __field(unsigned long long, mperf
)
57 __field(unsigned long long, aperf
)
58 __field(unsigned long long, tsc
)
59 __field(unsigned int, cpu_id
)
60 __field(bool, changed
)
61 __field(bool, fast_switch
)
65 __entry
->min_perf
= min_perf
;
66 __entry
->target_perf
= target_perf
;
67 __entry
->capacity
= capacity
;
69 __entry
->mperf
= mperf
;
70 __entry
->aperf
= aperf
;
72 __entry
->cpu_id
= cpu_id
;
73 __entry
->changed
= changed
;
74 __entry
->fast_switch
= fast_switch
;
77 TP_printk("amd_min_perf=%lu amd_des_perf=%lu amd_max_perf=%lu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u changed=%s fast_switch=%s",
78 (unsigned long)__entry
->min_perf
,
79 (unsigned long)__entry
->target_perf
,
80 (unsigned long)__entry
->capacity
,
81 (unsigned long long)__entry
->freq
,
82 (unsigned long long)__entry
->mperf
,
83 (unsigned long long)__entry
->aperf
,
84 (unsigned long long)__entry
->tsc
,
85 (unsigned int)__entry
->cpu_id
,
86 (__entry
->changed
) ? "true" : "false",
87 (__entry
->fast_switch
) ? "true" : "false"
91 #endif /* _AMD_PSTATE_TRACE_H */
93 /* This part must be outside protection */
94 #undef TRACE_INCLUDE_PATH
95 #define TRACE_INCLUDE_PATH .
97 #include <trace/define_trace.h>