1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM iocost
9 #if !defined(_TRACE_BLK_IOCOST_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _TRACE_BLK_IOCOST_H
12 #include <linux/tracepoint.h>
14 TRACE_EVENT(iocost_iocg_activate,
16 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
17 u64 last_period, u64 cur_period, u64 vtime),
19 TP_ARGS(iocg, path, now, last_period, cur_period, vtime),
22 __string(devname, ioc_name(iocg->ioc))
23 __string(cgroup, path)
27 __field(u64, last_period)
28 __field(u64, cur_period)
32 __field(u64, hweight_active)
33 __field(u64, hweight_inuse)
37 __assign_str(devname, ioc_name(iocg->ioc));
38 __assign_str(cgroup, path);
39 __entry->now = now->now;
40 __entry->vnow = now->vnow;
41 __entry->vrate = now->vrate;
42 __entry->last_period = last_period;
43 __entry->cur_period = cur_period;
44 __entry->vtime = vtime;
45 __entry->weight = iocg->weight;
46 __entry->inuse = iocg->inuse;
47 __entry->hweight_active = iocg->hweight_active;
48 __entry->hweight_inuse = iocg->hweight_inuse;
51 TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
52 "period=%llu->%llu vtime=%llu "
53 "weight=%u/%u hweight=%llu/%llu",
54 __get_str(devname), __get_str(cgroup),
55 __entry->now, __entry->vnow, __entry->vrate,
56 __entry->last_period, __entry->cur_period,
57 __entry->vtime, __entry->inuse, __entry->weight,
58 __entry->hweight_inuse, __entry->hweight_active
62 DECLARE_EVENT_CLASS(iocg_inuse_update,
64 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
65 u32 old_inuse, u32 new_inuse,
66 u64 old_hw_inuse, u64 new_hw_inuse),
68 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
69 old_hw_inuse, new_hw_inuse),
72 __string(devname, ioc_name(iocg->ioc))
73 __string(cgroup, path)
75 __field(u32, old_inuse)
76 __field(u32, new_inuse)
77 __field(u64, old_hweight_inuse)
78 __field(u64, new_hweight_inuse)
82 __assign_str(devname, ioc_name(iocg->ioc));
83 __assign_str(cgroup, path);
84 __entry->now = now->now;
85 __entry->old_inuse = old_inuse;
86 __entry->new_inuse = new_inuse;
87 __entry->old_hweight_inuse = old_hw_inuse;
88 __entry->new_hweight_inuse = new_hw_inuse;
91 TP_printk("[%s:%s] now=%llu inuse=%u->%u hw_inuse=%llu->%llu",
92 __get_str(devname), __get_str(cgroup), __entry->now,
93 __entry->old_inuse, __entry->new_inuse,
94 __entry->old_hweight_inuse, __entry->new_hweight_inuse
98 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_shortage,
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),
104 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
105 old_hw_inuse, new_hw_inuse)
108 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_transfer,
110 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
111 u32 old_inuse, u32 new_inuse,
112 u64 old_hw_inuse, u64 new_hw_inuse),
114 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
115 old_hw_inuse, new_hw_inuse)
118 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_adjust,
120 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
121 u32 old_inuse, u32 new_inuse,
122 u64 old_hw_inuse, u64 new_hw_inuse),
124 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
125 old_hw_inuse, new_hw_inuse)
128 TRACE_EVENT(iocost_ioc_vrate_adj,
130 TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
131 u32 rq_wait_pct, int nr_lagging, int nr_shortages),
133 TP_ARGS(ioc, new_vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages),
136 __string(devname, ioc_name(ioc))
137 __field(u64, old_vrate)
138 __field(u64, new_vrate)
139 __field(int, busy_level)
140 __field(u32, read_missed_ppm)
141 __field(u32, write_missed_ppm)
142 __field(u32, rq_wait_pct)
143 __field(int, nr_lagging)
144 __field(int, nr_shortages)
148 __assign_str(devname, ioc_name(ioc));
149 __entry->old_vrate = atomic64_read(&ioc->vtime_rate);;
150 __entry->new_vrate = new_vrate;
151 __entry->busy_level = ioc->busy_level;
152 __entry->read_missed_ppm = missed_ppm[READ];
153 __entry->write_missed_ppm = missed_ppm[WRITE];
154 __entry->rq_wait_pct = rq_wait_pct;
155 __entry->nr_lagging = nr_lagging;
156 __entry->nr_shortages = nr_shortages;
159 TP_printk("[%s] vrate=%llu->%llu busy=%d missed_ppm=%u:%u rq_wait_pct=%u lagging=%d shortages=%d",
160 __get_str(devname), __entry->old_vrate, __entry->new_vrate,
162 __entry->read_missed_ppm, __entry->write_missed_ppm,
163 __entry->rq_wait_pct, __entry->nr_lagging, __entry->nr_shortages
167 #endif /* _TRACE_BLK_IOCOST_H */
169 /* This part must be outside protection */
170 #include <trace/define_trace.h>