1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * amd-pstate-trace.h - AMD Processor P-state Frequency Driver Tracer
4 *
5 * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
6 *
7 * Author: Huang Rui <ray.huang@amd.com>
8 */
9
10#if !defined(_AMD_PSTATE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
11#define _AMD_PSTATE_TRACE_H
12
13#include <linux/cpufreq.h>
14#include <linux/tracepoint.h>
15#include <linux/trace_events.h>
16
17#undef TRACE_SYSTEM
18#define TRACE_SYSTEM amd_cpu
19
20#undef TRACE_INCLUDE_FILE
21#define TRACE_INCLUDE_FILE amd-pstate-trace
22
23#define TPS(x) tracepoint_string(x)
24
25TRACE_EVENT(amd_pstate_perf,
26
27 TP_PROTO(unsigned long min_perf,
28 unsigned long target_perf,
29 unsigned long capacity,
30 u64 freq,
31 u64 mperf,
32 u64 aperf,
33 u64 tsc,
34 unsigned int cpu_id,
35 bool changed,
36 bool fast_switch
37 ),
38
39 TP_ARGS(min_perf,
40 target_perf,
41 capacity,
42 freq,
43 mperf,
44 aperf,
45 tsc,
46 cpu_id,
47 changed,
48 fast_switch
49 ),
50
51 TP_STRUCT__entry(
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)
62 ),
63
64 TP_fast_assign(
65 __entry->min_perf = min_perf;
66 __entry->target_perf = target_perf;
67 __entry->capacity = capacity;
68 __entry->freq = freq;
69 __entry->mperf = mperf;
70 __entry->aperf = aperf;
71 __entry->tsc = tsc;
72 __entry->cpu_id = cpu_id;
73 __entry->changed = changed;
74 __entry->fast_switch = fast_switch;
75 ),
76
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"
88 )
89);
90
91#endif /* _AMD_PSTATE_TRACE_H */
92
93/* This part must be outside protection */
94#undef TRACE_INCLUDE_PATH
95#define TRACE_INCLUDE_PATH .
96
97#include <trace/define_trace.h>
98

source code of linux/drivers/cpufreq/amd-pstate-trace.h