Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * amd-pstate-trace.h - AMD Processor P-state Frequency Driver Tracer
0004  *
0005  * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
0006  *
0007  * Author: Huang Rui <ray.huang@amd.com>
0008  */
0009 
0010 #if !defined(_AMD_PSTATE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
0011 #define _AMD_PSTATE_TRACE_H
0012 
0013 #include <linux/cpufreq.h>
0014 #include <linux/tracepoint.h>
0015 #include <linux/trace_events.h>
0016 
0017 #undef TRACE_SYSTEM
0018 #define TRACE_SYSTEM amd_cpu
0019 
0020 #undef TRACE_INCLUDE_FILE
0021 #define TRACE_INCLUDE_FILE amd-pstate-trace
0022 
0023 #define TPS(x)  tracepoint_string(x)
0024 
0025 TRACE_EVENT(amd_pstate_perf,
0026 
0027     TP_PROTO(unsigned long min_perf,
0028          unsigned long target_perf,
0029          unsigned long capacity,
0030          u64 freq,
0031          u64 mperf,
0032          u64 aperf,
0033          u64 tsc,
0034          unsigned int cpu_id,
0035          bool changed,
0036          bool fast_switch
0037          ),
0038 
0039     TP_ARGS(min_perf,
0040         target_perf,
0041         capacity,
0042         freq,
0043         mperf,
0044         aperf,
0045         tsc,
0046         cpu_id,
0047         changed,
0048         fast_switch
0049         ),
0050 
0051     TP_STRUCT__entry(
0052         __field(unsigned long, min_perf)
0053         __field(unsigned long, target_perf)
0054         __field(unsigned long, capacity)
0055         __field(unsigned long long, freq)
0056         __field(unsigned long long, mperf)
0057         __field(unsigned long long, aperf)
0058         __field(unsigned long long, tsc)
0059         __field(unsigned int, cpu_id)
0060         __field(bool, changed)
0061         __field(bool, fast_switch)
0062         ),
0063 
0064     TP_fast_assign(
0065         __entry->min_perf = min_perf;
0066         __entry->target_perf = target_perf;
0067         __entry->capacity = capacity;
0068         __entry->freq = freq;
0069         __entry->mperf = mperf;
0070         __entry->aperf = aperf;
0071         __entry->tsc = tsc;
0072         __entry->cpu_id = cpu_id;
0073         __entry->changed = changed;
0074         __entry->fast_switch = fast_switch;
0075         ),
0076 
0077     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",
0078           (unsigned long)__entry->min_perf,
0079           (unsigned long)__entry->target_perf,
0080           (unsigned long)__entry->capacity,
0081           (unsigned long long)__entry->freq,
0082           (unsigned long long)__entry->mperf,
0083           (unsigned long long)__entry->aperf,
0084           (unsigned long long)__entry->tsc,
0085           (unsigned int)__entry->cpu_id,
0086           (__entry->changed) ? "true" : "false",
0087           (__entry->fast_switch) ? "true" : "false"
0088          )
0089 );
0090 
0091 #endif /* _AMD_PSTATE_TRACE_H */
0092 
0093 /* This part must be outside protection */
0094 #undef TRACE_INCLUDE_PATH
0095 #define TRACE_INCLUDE_PATH .
0096 
0097 #include <trace/define_trace.h>