amd-pstate-trace.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 <[email protected]>
  8. */
  9. #if !defined(_AMD_PSTATE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _AMD_PSTATE_TRACE_H
  11. #include <linux/cpufreq.h>
  12. #include <linux/tracepoint.h>
  13. #include <linux/trace_events.h>
  14. #undef TRACE_SYSTEM
  15. #define TRACE_SYSTEM amd_cpu
  16. #undef TRACE_INCLUDE_FILE
  17. #define TRACE_INCLUDE_FILE amd-pstate-trace
  18. #define TPS(x) tracepoint_string(x)
  19. TRACE_EVENT(amd_pstate_perf,
  20. TP_PROTO(unsigned long min_perf,
  21. unsigned long target_perf,
  22. unsigned long capacity,
  23. u64 freq,
  24. u64 mperf,
  25. u64 aperf,
  26. u64 tsc,
  27. unsigned int cpu_id,
  28. bool changed,
  29. bool fast_switch
  30. ),
  31. TP_ARGS(min_perf,
  32. target_perf,
  33. capacity,
  34. freq,
  35. mperf,
  36. aperf,
  37. tsc,
  38. cpu_id,
  39. changed,
  40. fast_switch
  41. ),
  42. TP_STRUCT__entry(
  43. __field(unsigned long, min_perf)
  44. __field(unsigned long, target_perf)
  45. __field(unsigned long, capacity)
  46. __field(unsigned long long, freq)
  47. __field(unsigned long long, mperf)
  48. __field(unsigned long long, aperf)
  49. __field(unsigned long long, tsc)
  50. __field(unsigned int, cpu_id)
  51. __field(bool, changed)
  52. __field(bool, fast_switch)
  53. ),
  54. TP_fast_assign(
  55. __entry->min_perf = min_perf;
  56. __entry->target_perf = target_perf;
  57. __entry->capacity = capacity;
  58. __entry->freq = freq;
  59. __entry->mperf = mperf;
  60. __entry->aperf = aperf;
  61. __entry->tsc = tsc;
  62. __entry->cpu_id = cpu_id;
  63. __entry->changed = changed;
  64. __entry->fast_switch = fast_switch;
  65. ),
  66. 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",
  67. (unsigned long)__entry->min_perf,
  68. (unsigned long)__entry->target_perf,
  69. (unsigned long)__entry->capacity,
  70. (unsigned long long)__entry->freq,
  71. (unsigned long long)__entry->mperf,
  72. (unsigned long long)__entry->aperf,
  73. (unsigned long long)__entry->tsc,
  74. (unsigned int)__entry->cpu_id,
  75. (__entry->changed) ? "true" : "false",
  76. (__entry->fast_switch) ? "true" : "false"
  77. )
  78. );
  79. #endif /* _AMD_PSTATE_TRACE_H */
  80. /* This part must be outside protection */
  81. #undef TRACE_INCLUDE_PATH
  82. #define TRACE_INCLUDE_PATH .
  83. #include <trace/define_trace.h>