0b6869980ba22d0ef74adb48217b0af53e0d4823
[linux-2.6-microblaze.git] / include / trace / events / iocost.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM iocost
4
5 struct ioc;
6 struct ioc_now;
7 struct ioc_gq;
8
9 #if !defined(_TRACE_BLK_IOCOST_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _TRACE_BLK_IOCOST_H
11
12 #include <linux/tracepoint.h>
13
14 TRACE_EVENT(iocost_iocg_activate,
15
16         TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
17                 u64 last_period, u64 cur_period, u64 vtime),
18
19         TP_ARGS(iocg, path, now, last_period, cur_period, vtime),
20
21         TP_STRUCT__entry (
22                 __string(devname, ioc_name(iocg->ioc))
23                 __string(cgroup, path)
24                 __field(u64, now)
25                 __field(u64, vnow)
26                 __field(u64, vrate)
27                 __field(u64, last_period)
28                 __field(u64, cur_period)
29                 __field(u64, vtime)
30                 __field(u32, weight)
31                 __field(u32, inuse)
32                 __field(u64, hweight_active)
33                 __field(u64, hweight_inuse)
34         ),
35
36         TP_fast_assign(
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;
49         ),
50
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
59         )
60 );
61
62 DECLARE_EVENT_CLASS(iocg_inuse_update,
63
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),
67
68         TP_ARGS(iocg, path, now, old_inuse, new_inuse,
69                 old_hw_inuse, new_hw_inuse),
70
71         TP_STRUCT__entry (
72                 __string(devname, ioc_name(iocg->ioc))
73                 __string(cgroup, path)
74                 __field(u64, now)
75                 __field(u32, old_inuse)
76                 __field(u32, new_inuse)
77                 __field(u64, old_hweight_inuse)
78                 __field(u64, new_hweight_inuse)
79         ),
80
81         TP_fast_assign(
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;
89         ),
90
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
95         )
96 );
97
98 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_shortage,
99
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
104         TP_ARGS(iocg, path, now, old_inuse, new_inuse,
105                 old_hw_inuse, new_hw_inuse)
106 );
107
108 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_transfer,
109
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),
113
114         TP_ARGS(iocg, path, now, old_inuse, new_inuse,
115                 old_hw_inuse, new_hw_inuse)
116 );
117
118 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_adjust,
119
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),
123
124         TP_ARGS(iocg, path, now, old_inuse, new_inuse,
125                 old_hw_inuse, new_hw_inuse)
126 );
127
128 TRACE_EVENT(iocost_ioc_vrate_adj,
129
130         TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
131                 u32 rq_wait_pct, int nr_lagging, int nr_shortages),
132
133         TP_ARGS(ioc, new_vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages),
134
135         TP_STRUCT__entry (
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)
145         ),
146
147         TP_fast_assign(
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;
157         ),
158
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,
161                 __entry->busy_level,
162                 __entry->read_missed_ppm, __entry->write_missed_ppm,
163                 __entry->rq_wait_pct, __entry->nr_lagging, __entry->nr_shortages
164         )
165 );
166
167 TRACE_EVENT(iocost_iocg_forgive_debt,
168
169         TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
170                 u32 usage_pct, u64 old_debt, u64 new_debt,
171                 u64 old_delay, u64 new_delay),
172
173         TP_ARGS(iocg, path, now, usage_pct,
174                 old_debt, new_debt, old_delay, new_delay),
175
176         TP_STRUCT__entry (
177                 __string(devname, ioc_name(iocg->ioc))
178                 __string(cgroup, path)
179                 __field(u64, now)
180                 __field(u64, vnow)
181                 __field(u32, usage_pct)
182                 __field(u64, old_debt)
183                 __field(u64, new_debt)
184                 __field(u64, old_delay)
185                 __field(u64, new_delay)
186         ),
187
188         TP_fast_assign(
189                 __assign_str(devname, ioc_name(iocg->ioc));
190                 __assign_str(cgroup, path);
191                 __entry->now = now->now;
192                 __entry->vnow = now->vnow;
193                 __entry->usage_pct = usage_pct;
194                 __entry->old_debt = old_debt;
195                 __entry->new_debt = new_debt;
196                 __entry->old_delay = old_delay;
197                 __entry->new_delay = new_delay;
198         ),
199
200         TP_printk("[%s:%s] now=%llu:%llu usage=%u debt=%llu->%llu delay=%llu->%llu",
201                 __get_str(devname), __get_str(cgroup),
202                 __entry->now, __entry->vnow, __entry->usage_pct,
203                 __entry->old_debt, __entry->new_debt,
204                 __entry->old_delay, __entry->new_delay
205         )
206 );
207
208 #endif /* _TRACE_BLK_IOCOST_H */
209
210 /* This part must be outside protection */
211 #include <trace/define_trace.h>