thermal.h 4.9 KB

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