1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM wbt
5 #if !defined(_TRACE_WBT_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
9 #include "../../../block/blk-wbt.h"
12 * wbt_stat - trace stats for blk_wb
13 * @stat: array of read/write stats
17 TP_PROTO(struct backing_dev_info
*bdi
, struct blk_rq_stat
*stat
),
22 __array(char, name
, 32)
26 __field(s64
, rnr_samples
)
31 __field(s64
, wnr_samples
)
36 strlcpy(__entry
->name
, dev_name(bdi
->dev
),
37 ARRAY_SIZE(__entry
->name
));
38 __entry
->rmean
= stat
[0].mean
;
39 __entry
->rmin
= stat
[0].min
;
40 __entry
->rmax
= stat
[0].max
;
41 __entry
->rnr_samples
= stat
[0].nr_samples
;
42 __entry
->wmean
= stat
[1].mean
;
43 __entry
->wmin
= stat
[1].min
;
44 __entry
->wmax
= stat
[1].max
;
45 __entry
->wnr_samples
= stat
[1].nr_samples
;
48 TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, "
49 "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu\n",
50 __entry
->name
, __entry
->rmean
, __entry
->rmin
, __entry
->rmax
,
51 __entry
->rnr_samples
, __entry
->wmean
, __entry
->wmin
,
52 __entry
->wmax
, __entry
->wnr_samples
)
56 * wbt_lat - trace latency event
57 * @lat: latency trigger
61 TP_PROTO(struct backing_dev_info
*bdi
, unsigned long lat
),
66 __array(char, name
, 32)
67 __field(unsigned long, lat
)
71 strlcpy(__entry
->name
, dev_name(bdi
->dev
),
72 ARRAY_SIZE(__entry
->name
));
73 __entry
->lat
= div_u64(lat
, 1000);
76 TP_printk("%s: latency %lluus\n", __entry
->name
,
77 (unsigned long long) __entry
->lat
)
81 * wbt_step - trace wb event step
82 * @msg: context message
83 * @step: the current scale step count
84 * @window: the current monitoring window
85 * @bg: the current background queue limit
86 * @normal: the current normal writeback limit
87 * @max: the current max throughput writeback limit
91 TP_PROTO(struct backing_dev_info
*bdi
, const char *msg
,
92 int step
, unsigned long window
, unsigned int bg
,
93 unsigned int normal
, unsigned int max
),
95 TP_ARGS(bdi
, msg
, step
, window
, bg
, normal
, max
),
98 __array(char, name
, 32)
99 __field(const char *, msg
)
101 __field(unsigned long, window
)
102 __field(unsigned int, bg
)
103 __field(unsigned int, normal
)
104 __field(unsigned int, max
)
108 strlcpy(__entry
->name
, dev_name(bdi
->dev
),
109 ARRAY_SIZE(__entry
->name
));
111 __entry
->step
= step
;
112 __entry
->window
= div_u64(window
, 1000);
114 __entry
->normal
= normal
;
118 TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u\n",
119 __entry
->name
, __entry
->msg
, __entry
->step
, __entry
->window
,
120 __entry
->bg
, __entry
->normal
, __entry
->max
)
124 * wbt_timer - trace wb timer event
125 * @status: timer state status
126 * @step: the current scale step count
127 * @inflight: tracked writes inflight
129 TRACE_EVENT(wbt_timer
,
131 TP_PROTO(struct backing_dev_info
*bdi
, unsigned int status
,
132 int step
, unsigned int inflight
),
134 TP_ARGS(bdi
, status
, step
, inflight
),
137 __array(char, name
, 32)
138 __field(unsigned int, status
)
140 __field(unsigned int, inflight
)
144 strlcpy(__entry
->name
, dev_name(bdi
->dev
),
145 ARRAY_SIZE(__entry
->name
));
146 __entry
->status
= status
;
147 __entry
->step
= step
;
148 __entry
->inflight
= inflight
;
151 TP_printk("%s: status=%u, step=%d, inflight=%u\n", __entry
->name
,
152 __entry
->status
, __entry
->step
, __entry
->inflight
)
155 #endif /* _TRACE_WBT_H */
157 /* This part must be outside protection */
158 #include <trace/define_trace.h>