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 strncpy(__entry->name, dev_name(bdi->dev), 32);
37 __entry->rmean = stat[0].mean;
38 __entry->rmin = stat[0].min;
39 __entry->rmax = stat[0].max;
40 __entry->rnr_samples = stat[0].nr_samples;
41 __entry->wmean = stat[1].mean;
42 __entry->wmin = stat[1].min;
43 __entry->wmax = stat[1].max;
44 __entry->wnr_samples = stat[1].nr_samples;
47 TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, "
48 "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu\n",
49 __entry->name, __entry->rmean, __entry->rmin, __entry->rmax,
50 __entry->rnr_samples, __entry->wmean, __entry->wmin,
51 __entry->wmax, __entry->wnr_samples)
55 * wbt_lat - trace latency event
56 * @lat: latency trigger
60 TP_PROTO(struct backing_dev_info *bdi, unsigned long lat),
65 __array(char, name, 32)
66 __field(unsigned long, lat)
70 strncpy(__entry->name, dev_name(bdi->dev), 32);
71 __entry->lat = div_u64(lat, 1000);
74 TP_printk("%s: latency %lluus\n", __entry->name,
75 (unsigned long long) __entry->lat)
79 * wbt_step - trace wb event step
80 * @msg: context message
81 * @step: the current scale step count
82 * @window: the current monitoring window
83 * @bg: the current background queue limit
84 * @normal: the current normal writeback limit
85 * @max: the current max throughput writeback limit
89 TP_PROTO(struct backing_dev_info *bdi, const char *msg,
90 int step, unsigned long window, unsigned int bg,
91 unsigned int normal, unsigned int max),
93 TP_ARGS(bdi, msg, step, window, bg, normal, max),
96 __array(char, name, 32)
97 __field(const char *, msg)
99 __field(unsigned long, window)
100 __field(unsigned int, bg)
101 __field(unsigned int, normal)
102 __field(unsigned int, max)
106 strncpy(__entry->name, dev_name(bdi->dev), 32);
108 __entry->step = step;
109 __entry->window = div_u64(window, 1000);
111 __entry->normal = normal;
115 TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u\n",
116 __entry->name, __entry->msg, __entry->step, __entry->window,
117 __entry->bg, __entry->normal, __entry->max)
121 * wbt_timer - trace wb timer event
122 * @status: timer state status
123 * @step: the current scale step count
124 * @inflight: tracked writes inflight
126 TRACE_EVENT(wbt_timer,
128 TP_PROTO(struct backing_dev_info *bdi, unsigned int status,
129 int step, unsigned int inflight),
131 TP_ARGS(bdi, status, step, inflight),
134 __array(char, name, 32)
135 __field(unsigned int, status)
137 __field(unsigned int, inflight)
141 strncpy(__entry->name, dev_name(bdi->dev), 32);
142 __entry->status = status;
143 __entry->step = step;
144 __entry->inflight = inflight;
147 TP_printk("%s: status=%u, step=%d, inflight=%u\n", __entry->name,
148 __entry->status, __entry->step, __entry->inflight)
151 #endif /* _TRACE_WBT_H */
153 /* This part must be outside protection */
154 #include <trace/define_trace.h>