iocost.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM iocost
  4. struct ioc;
  5. struct ioc_now;
  6. struct ioc_gq;
  7. #if !defined(_TRACE_BLK_IOCOST_H) || defined(TRACE_HEADER_MULTI_READ)
  8. #define _TRACE_BLK_IOCOST_H
  9. #include <linux/tracepoint.h>
  10. DECLARE_EVENT_CLASS(iocost_iocg_state,
  11. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  12. u64 last_period, u64 cur_period, u64 vtime),
  13. TP_ARGS(iocg, path, now, last_period, cur_period, vtime),
  14. TP_STRUCT__entry (
  15. __string(devname, ioc_name(iocg->ioc))
  16. __string(cgroup, path)
  17. __field(u64, now)
  18. __field(u64, vnow)
  19. __field(u64, vrate)
  20. __field(u64, last_period)
  21. __field(u64, cur_period)
  22. __field(u64, vtime)
  23. __field(u32, weight)
  24. __field(u32, inuse)
  25. __field(u64, hweight_active)
  26. __field(u64, hweight_inuse)
  27. ),
  28. TP_fast_assign(
  29. __assign_str(devname, ioc_name(iocg->ioc));
  30. __assign_str(cgroup, path);
  31. __entry->now = now->now;
  32. __entry->vnow = now->vnow;
  33. __entry->vrate = now->vrate;
  34. __entry->last_period = last_period;
  35. __entry->cur_period = cur_period;
  36. __entry->vtime = vtime;
  37. __entry->weight = iocg->weight;
  38. __entry->inuse = iocg->inuse;
  39. __entry->hweight_active = iocg->hweight_active;
  40. __entry->hweight_inuse = iocg->hweight_inuse;
  41. ),
  42. TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
  43. "period=%llu->%llu vtime=%llu "
  44. "weight=%u/%u hweight=%llu/%llu",
  45. __get_str(devname), __get_str(cgroup),
  46. __entry->now, __entry->vnow, __entry->vrate,
  47. __entry->last_period, __entry->cur_period,
  48. __entry->vtime, __entry->inuse, __entry->weight,
  49. __entry->hweight_inuse, __entry->hweight_active
  50. )
  51. );
  52. DEFINE_EVENT(iocost_iocg_state, iocost_iocg_activate,
  53. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  54. u64 last_period, u64 cur_period, u64 vtime),
  55. TP_ARGS(iocg, path, now, last_period, cur_period, vtime)
  56. );
  57. DEFINE_EVENT(iocost_iocg_state, iocost_iocg_idle,
  58. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  59. u64 last_period, u64 cur_period, u64 vtime),
  60. TP_ARGS(iocg, path, now, last_period, cur_period, vtime)
  61. );
  62. DECLARE_EVENT_CLASS(iocg_inuse_update,
  63. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  64. u32 old_inuse, u32 new_inuse,
  65. u64 old_hw_inuse, u64 new_hw_inuse),
  66. TP_ARGS(iocg, path, now, old_inuse, new_inuse,
  67. old_hw_inuse, new_hw_inuse),
  68. TP_STRUCT__entry (
  69. __string(devname, ioc_name(iocg->ioc))
  70. __string(cgroup, path)
  71. __field(u64, now)
  72. __field(u32, old_inuse)
  73. __field(u32, new_inuse)
  74. __field(u64, old_hweight_inuse)
  75. __field(u64, new_hweight_inuse)
  76. ),
  77. TP_fast_assign(
  78. __assign_str(devname, ioc_name(iocg->ioc));
  79. __assign_str(cgroup, path);
  80. __entry->now = now->now;
  81. __entry->old_inuse = old_inuse;
  82. __entry->new_inuse = new_inuse;
  83. __entry->old_hweight_inuse = old_hw_inuse;
  84. __entry->new_hweight_inuse = new_hw_inuse;
  85. ),
  86. TP_printk("[%s:%s] now=%llu inuse=%u->%u hw_inuse=%llu->%llu",
  87. __get_str(devname), __get_str(cgroup), __entry->now,
  88. __entry->old_inuse, __entry->new_inuse,
  89. __entry->old_hweight_inuse, __entry->new_hweight_inuse
  90. )
  91. );
  92. DEFINE_EVENT(iocg_inuse_update, iocost_inuse_shortage,
  93. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  94. u32 old_inuse, u32 new_inuse,
  95. u64 old_hw_inuse, u64 new_hw_inuse),
  96. TP_ARGS(iocg, path, now, old_inuse, new_inuse,
  97. old_hw_inuse, new_hw_inuse)
  98. );
  99. DEFINE_EVENT(iocg_inuse_update, iocost_inuse_transfer,
  100. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  101. u32 old_inuse, u32 new_inuse,
  102. u64 old_hw_inuse, u64 new_hw_inuse),
  103. TP_ARGS(iocg, path, now, old_inuse, new_inuse,
  104. old_hw_inuse, new_hw_inuse)
  105. );
  106. DEFINE_EVENT(iocg_inuse_update, iocost_inuse_adjust,
  107. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  108. u32 old_inuse, u32 new_inuse,
  109. u64 old_hw_inuse, u64 new_hw_inuse),
  110. TP_ARGS(iocg, path, now, old_inuse, new_inuse,
  111. old_hw_inuse, new_hw_inuse)
  112. );
  113. TRACE_EVENT(iocost_ioc_vrate_adj,
  114. TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
  115. u32 rq_wait_pct, int nr_lagging, int nr_shortages),
  116. TP_ARGS(ioc, new_vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages),
  117. TP_STRUCT__entry (
  118. __string(devname, ioc_name(ioc))
  119. __field(u64, old_vrate)
  120. __field(u64, new_vrate)
  121. __field(int, busy_level)
  122. __field(u32, read_missed_ppm)
  123. __field(u32, write_missed_ppm)
  124. __field(u32, rq_wait_pct)
  125. __field(int, nr_lagging)
  126. __field(int, nr_shortages)
  127. ),
  128. TP_fast_assign(
  129. __assign_str(devname, ioc_name(ioc));
  130. __entry->old_vrate = atomic64_read(&ioc->vtime_rate);
  131. __entry->new_vrate = new_vrate;
  132. __entry->busy_level = ioc->busy_level;
  133. __entry->read_missed_ppm = missed_ppm[READ];
  134. __entry->write_missed_ppm = missed_ppm[WRITE];
  135. __entry->rq_wait_pct = rq_wait_pct;
  136. __entry->nr_lagging = nr_lagging;
  137. __entry->nr_shortages = nr_shortages;
  138. ),
  139. TP_printk("[%s] vrate=%llu->%llu busy=%d missed_ppm=%u:%u rq_wait_pct=%u lagging=%d shortages=%d",
  140. __get_str(devname), __entry->old_vrate, __entry->new_vrate,
  141. __entry->busy_level,
  142. __entry->read_missed_ppm, __entry->write_missed_ppm,
  143. __entry->rq_wait_pct, __entry->nr_lagging, __entry->nr_shortages
  144. )
  145. );
  146. TRACE_EVENT(iocost_iocg_forgive_debt,
  147. TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
  148. u32 usage_pct, u64 old_debt, u64 new_debt,
  149. u64 old_delay, u64 new_delay),
  150. TP_ARGS(iocg, path, now, usage_pct,
  151. old_debt, new_debt, old_delay, new_delay),
  152. TP_STRUCT__entry (
  153. __string(devname, ioc_name(iocg->ioc))
  154. __string(cgroup, path)
  155. __field(u64, now)
  156. __field(u64, vnow)
  157. __field(u32, usage_pct)
  158. __field(u64, old_debt)
  159. __field(u64, new_debt)
  160. __field(u64, old_delay)
  161. __field(u64, new_delay)
  162. ),
  163. TP_fast_assign(
  164. __assign_str(devname, ioc_name(iocg->ioc));
  165. __assign_str(cgroup, path);
  166. __entry->now = now->now;
  167. __entry->vnow = now->vnow;
  168. __entry->usage_pct = usage_pct;
  169. __entry->old_debt = old_debt;
  170. __entry->new_debt = new_debt;
  171. __entry->old_delay = old_delay;
  172. __entry->new_delay = new_delay;
  173. ),
  174. TP_printk("[%s:%s] now=%llu:%llu usage=%u debt=%llu->%llu delay=%llu->%llu",
  175. __get_str(devname), __get_str(cgroup),
  176. __entry->now, __entry->vnow, __entry->usage_pct,
  177. __entry->old_debt, __entry->new_debt,
  178. __entry->old_delay, __entry->new_delay
  179. )
  180. );
  181. #endif /* _TRACE_BLK_IOCOST_H */
  182. /* This part must be outside protection */
  183. #include <trace/define_trace.h>