power.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM power
  3. #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_POWER_H
  5. #include <linux/ktime.h>
  6. #include <linux/tracepoint.h>
  7. #ifndef _TRACE_POWER_ENUM_
  8. #define _TRACE_POWER_ENUM_
  9. enum {
  10. POWER_NONE = 0,
  11. POWER_CSTATE = 1, /* C-State */
  12. POWER_PSTATE = 2, /* Fequency change or DVFS */
  13. POWER_SSTATE = 3, /* Suspend */
  14. };
  15. #endif
  16. /*
  17. * The power events are used for cpuidle & suspend (power_start, power_end)
  18. * and for cpufreq (power_frequency)
  19. */
  20. DECLARE_EVENT_CLASS(power,
  21. TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
  22. TP_ARGS(type, state, cpu_id),
  23. TP_STRUCT__entry(
  24. __field( u64, type )
  25. __field( u64, state )
  26. __field( u64, cpu_id )
  27. ),
  28. TP_fast_assign(
  29. __entry->type = type;
  30. __entry->state = state;
  31. __entry->cpu_id = cpu_id;
  32. ),
  33. TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
  34. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  35. );
  36. DEFINE_EVENT(power, power_start,
  37. TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
  38. TP_ARGS(type, state, cpu_id)
  39. );
  40. DEFINE_EVENT(power, power_frequency,
  41. TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
  42. TP_ARGS(type, state, cpu_id)
  43. );
  44. TRACE_EVENT(power_end,
  45. TP_PROTO(unsigned int cpu_id),
  46. TP_ARGS(cpu_id),
  47. TP_STRUCT__entry(
  48. __field( u64, cpu_id )
  49. ),
  50. TP_fast_assign(
  51. __entry->cpu_id = cpu_id;
  52. ),
  53. TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
  54. );
  55. /*
  56. * The clock events are used for clock enable/disable and for
  57. * clock rate change
  58. */
  59. DECLARE_EVENT_CLASS(clock,
  60. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  61. TP_ARGS(name, state, cpu_id),
  62. TP_STRUCT__entry(
  63. __string( name, name )
  64. __field( u64, state )
  65. __field( u64, cpu_id )
  66. ),
  67. TP_fast_assign(
  68. __assign_str(name, name);
  69. __entry->state = state;
  70. __entry->cpu_id = cpu_id;
  71. ),
  72. TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
  73. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  74. );
  75. DEFINE_EVENT(clock, clock_enable,
  76. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  77. TP_ARGS(name, state, cpu_id)
  78. );
  79. DEFINE_EVENT(clock, clock_disable,
  80. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  81. TP_ARGS(name, state, cpu_id)
  82. );
  83. DEFINE_EVENT(clock, clock_set_rate,
  84. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  85. TP_ARGS(name, state, cpu_id)
  86. );
  87. /*
  88. * The power domain events are used for power domains transitions
  89. */
  90. DECLARE_EVENT_CLASS(power_domain,
  91. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  92. TP_ARGS(name, state, cpu_id),
  93. TP_STRUCT__entry(
  94. __string( name, name )
  95. __field( u64, state )
  96. __field( u64, cpu_id )
  97. ),
  98. TP_fast_assign(
  99. __assign_str(name, name);
  100. __entry->state = state;
  101. __entry->cpu_id = cpu_id;
  102. ),
  103. TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
  104. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  105. );
  106. DEFINE_EVENT(power_domain, power_domain_target,
  107. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  108. TP_ARGS(name, state, cpu_id)
  109. );
  110. #endif /* _TRACE_POWER_H */
  111. /* This part must be outside protection */
  112. #include <trace/define_trace.h>