thermal.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM thermal
  3. #if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_THERMAL_H
  5. #include <linux/devfreq.h>
  6. #include <linux/thermal.h>
  7. #include <linux/tracepoint.h>
  8. TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL);
  9. TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT);
  10. TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE);
  11. TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE);
  12. #define show_tzt_type(type) \
  13. __print_symbolic(type, \
  14. { THERMAL_TRIP_CRITICAL, "CRITICAL"}, \
  15. { THERMAL_TRIP_HOT, "HOT"}, \
  16. { THERMAL_TRIP_PASSIVE, "PASSIVE"}, \
  17. { THERMAL_TRIP_ACTIVE, "ACTIVE"})
  18. TRACE_EVENT(thermal_temperature,
  19. TP_PROTO(struct thermal_zone_device *tz),
  20. TP_ARGS(tz),
  21. TP_STRUCT__entry(
  22. __string(thermal_zone, tz->type)
  23. __field(int, id)
  24. __field(int, temp_prev)
  25. __field(int, temp)
  26. ),
  27. TP_fast_assign(
  28. __assign_str(thermal_zone, tz->type);
  29. __entry->id = tz->id;
  30. __entry->temp_prev = tz->last_temperature;
  31. __entry->temp = tz->temperature;
  32. ),
  33. TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
  34. __get_str(thermal_zone), __entry->id, __entry->temp_prev,
  35. __entry->temp)
  36. );
  37. TRACE_EVENT(cdev_update,
  38. TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target),
  39. TP_ARGS(cdev, target),
  40. TP_STRUCT__entry(
  41. __string(type, cdev->type)
  42. __field(unsigned long, target)
  43. ),
  44. TP_fast_assign(
  45. __assign_str(type, cdev->type);
  46. __entry->target = target;
  47. ),
  48. TP_printk("type=%s target=%lu", __get_str(type), __entry->target)
  49. );
  50. TRACE_EVENT(thermal_zone_trip,
  51. TP_PROTO(struct thermal_zone_device *tz, int trip,
  52. enum thermal_trip_type trip_type),
  53. TP_ARGS(tz, trip, trip_type),
  54. TP_STRUCT__entry(
  55. __string(thermal_zone, tz->type)
  56. __field(int, id)
  57. __field(int, trip)
  58. __field(enum thermal_trip_type, trip_type)
  59. ),
  60. TP_fast_assign(
  61. __assign_str(thermal_zone, tz->type);
  62. __entry->id = tz->id;
  63. __entry->trip = trip;
  64. __entry->trip_type = trip_type;
  65. ),
  66. TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%s",
  67. __get_str(thermal_zone), __entry->id, __entry->trip,
  68. show_tzt_type(__entry->trip_type))
  69. );
  70. TRACE_EVENT(thermal_power_cpu_get_power,
  71. TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load,
  72. size_t load_len, u32 dynamic_power, u32 static_power),
  73. TP_ARGS(cpus, freq, load, load_len, dynamic_power, static_power),
  74. TP_STRUCT__entry(
  75. __bitmask(cpumask, num_possible_cpus())
  76. __field(unsigned long, freq )
  77. __dynamic_array(u32, load, load_len)
  78. __field(size_t, load_len )
  79. __field(u32, dynamic_power )
  80. __field(u32, static_power )
  81. ),
  82. TP_fast_assign(
  83. __assign_bitmask(cpumask, cpumask_bits(cpus),
  84. num_possible_cpus());
  85. __entry->freq = freq;
  86. memcpy(__get_dynamic_array(load), load,
  87. load_len * sizeof(*load));
  88. __entry->load_len = load_len;
  89. __entry->dynamic_power = dynamic_power;
  90. __entry->static_power = static_power;
  91. ),
  92. TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d static_power=%d",
  93. __get_bitmask(cpumask), __entry->freq,
  94. __print_array(__get_dynamic_array(load), __entry->load_len, 4),
  95. __entry->dynamic_power, __entry->static_power)
  96. );
  97. TRACE_EVENT(thermal_power_cpu_limit,
  98. TP_PROTO(const struct cpumask *cpus, unsigned int freq,
  99. unsigned long cdev_state, u32 power),
  100. TP_ARGS(cpus, freq, cdev_state, power),
  101. TP_STRUCT__entry(
  102. __bitmask(cpumask, num_possible_cpus())
  103. __field(unsigned int, freq )
  104. __field(unsigned long, cdev_state)
  105. __field(u32, power )
  106. ),
  107. TP_fast_assign(
  108. __assign_bitmask(cpumask, cpumask_bits(cpus),
  109. num_possible_cpus());
  110. __entry->freq = freq;
  111. __entry->cdev_state = cdev_state;
  112. __entry->power = power;
  113. ),
  114. TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u",
  115. __get_bitmask(cpumask), __entry->freq, __entry->cdev_state,
  116. __entry->power)
  117. );
  118. TRACE_EVENT(thermal_power_devfreq_get_power,
  119. TP_PROTO(struct thermal_cooling_device *cdev,
  120. struct devfreq_dev_status *status, unsigned long freq,
  121. u32 dynamic_power, u32 static_power),
  122. TP_ARGS(cdev, status, freq, dynamic_power, static_power),
  123. TP_STRUCT__entry(
  124. __string(type, cdev->type )
  125. __field(unsigned long, freq )
  126. __field(u32, load )
  127. __field(u32, dynamic_power )
  128. __field(u32, static_power )
  129. ),
  130. TP_fast_assign(
  131. __assign_str(type, cdev->type);
  132. __entry->freq = freq;
  133. __entry->load = (100 * status->busy_time) / status->total_time;
  134. __entry->dynamic_power = dynamic_power;
  135. __entry->static_power = static_power;
  136. ),
  137. TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u",
  138. __get_str(type), __entry->freq,
  139. __entry->load, __entry->dynamic_power, __entry->static_power)
  140. );
  141. TRACE_EVENT(thermal_power_devfreq_limit,
  142. TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq,
  143. unsigned long cdev_state, u32 power),
  144. TP_ARGS(cdev, freq, cdev_state, power),
  145. TP_STRUCT__entry(
  146. __string(type, cdev->type)
  147. __field(unsigned int, freq )
  148. __field(unsigned long, cdev_state)
  149. __field(u32, power )
  150. ),
  151. TP_fast_assign(
  152. __assign_str(type, cdev->type);
  153. __entry->freq = freq;
  154. __entry->cdev_state = cdev_state;
  155. __entry->power = power;
  156. ),
  157. TP_printk("type=%s freq=%u cdev_state=%lu power=%u",
  158. __get_str(type), __entry->freq, __entry->cdev_state,
  159. __entry->power)
  160. );
  161. #endif /* _TRACE_THERMAL_H */
  162. /* This part must be outside protection */
  163. #include <trace/define_trace.h>