power.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. DECLARE_EVENT_CLASS(cpu,
  8. TP_PROTO(unsigned int state, unsigned int cpu_id),
  9. TP_ARGS(state, cpu_id),
  10. TP_STRUCT__entry(
  11. __field( u32, state )
  12. __field( u32, cpu_id )
  13. ),
  14. TP_fast_assign(
  15. __entry->state = state;
  16. __entry->cpu_id = cpu_id;
  17. ),
  18. TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
  19. (unsigned long)__entry->cpu_id)
  20. );
  21. DEFINE_EVENT(cpu, cpu_idle,
  22. TP_PROTO(unsigned int state, unsigned int cpu_id),
  23. TP_ARGS(state, cpu_id)
  24. );
  25. /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
  26. #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
  27. #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
  28. #define PWR_EVENT_EXIT -1
  29. #endif
  30. DEFINE_EVENT(cpu, cpu_frequency,
  31. TP_PROTO(unsigned int frequency, unsigned int cpu_id),
  32. TP_ARGS(frequency, cpu_id)
  33. );
  34. TRACE_EVENT(machine_suspend,
  35. TP_PROTO(unsigned int state),
  36. TP_ARGS(state),
  37. TP_STRUCT__entry(
  38. __field( u32, state )
  39. ),
  40. TP_fast_assign(
  41. __entry->state = state;
  42. ),
  43. TP_printk("state=%lu", (unsigned long)__entry->state)
  44. );
  45. DECLARE_EVENT_CLASS(wakeup_source,
  46. TP_PROTO(const char *name, unsigned int state),
  47. TP_ARGS(name, state),
  48. TP_STRUCT__entry(
  49. __string( name, name )
  50. __field( u64, state )
  51. ),
  52. TP_fast_assign(
  53. __assign_str(name, name);
  54. __entry->state = state;
  55. ),
  56. TP_printk("%s state=0x%lx", __get_str(name),
  57. (unsigned long)__entry->state)
  58. );
  59. DEFINE_EVENT(wakeup_source, wakeup_source_activate,
  60. TP_PROTO(const char *name, unsigned int state),
  61. TP_ARGS(name, state)
  62. );
  63. DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
  64. TP_PROTO(const char *name, unsigned int state),
  65. TP_ARGS(name, state)
  66. );
  67. /*
  68. * The clock events are used for clock enable/disable and for
  69. * clock rate change
  70. */
  71. DECLARE_EVENT_CLASS(clock,
  72. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  73. TP_ARGS(name, state, cpu_id),
  74. TP_STRUCT__entry(
  75. __string( name, name )
  76. __field( u64, state )
  77. __field( u64, cpu_id )
  78. ),
  79. TP_fast_assign(
  80. __assign_str(name, name);
  81. __entry->state = state;
  82. __entry->cpu_id = cpu_id;
  83. ),
  84. TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
  85. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  86. );
  87. DEFINE_EVENT(clock, clock_enable,
  88. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  89. TP_ARGS(name, state, cpu_id)
  90. );
  91. DEFINE_EVENT(clock, clock_disable,
  92. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  93. TP_ARGS(name, state, cpu_id)
  94. );
  95. DEFINE_EVENT(clock, clock_set_rate,
  96. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  97. TP_ARGS(name, state, cpu_id)
  98. );
  99. /*
  100. * The power domain events are used for power domains transitions
  101. */
  102. DECLARE_EVENT_CLASS(power_domain,
  103. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  104. TP_ARGS(name, state, cpu_id),
  105. TP_STRUCT__entry(
  106. __string( name, name )
  107. __field( u64, state )
  108. __field( u64, cpu_id )
  109. ),
  110. TP_fast_assign(
  111. __assign_str(name, name);
  112. __entry->state = state;
  113. __entry->cpu_id = cpu_id;
  114. ),
  115. TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
  116. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  117. );
  118. DEFINE_EVENT(power_domain, power_domain_target,
  119. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  120. TP_ARGS(name, state, cpu_id)
  121. );
  122. #endif /* _TRACE_POWER_H */
  123. /* This part must be outside protection */
  124. #include <trace/define_trace.h>