Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM wbt
0004 
0005 #if !defined(_TRACE_WBT_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_WBT_H
0007 
0008 #include <linux/tracepoint.h>
0009 #include "../../../block/blk-wbt.h"
0010 
0011 /**
0012  * wbt_stat - trace stats for blk_wb
0013  * @stat: array of read/write stats
0014  */
0015 TRACE_EVENT(wbt_stat,
0016 
0017     TP_PROTO(struct backing_dev_info *bdi, struct blk_rq_stat *stat),
0018 
0019     TP_ARGS(bdi, stat),
0020 
0021     TP_STRUCT__entry(
0022         __array(char, name, 32)
0023         __field(s64, rmean)
0024         __field(u64, rmin)
0025         __field(u64, rmax)
0026         __field(s64, rnr_samples)
0027         __field(s64, rtime)
0028         __field(s64, wmean)
0029         __field(u64, wmin)
0030         __field(u64, wmax)
0031         __field(s64, wnr_samples)
0032         __field(s64, wtime)
0033     ),
0034 
0035     TP_fast_assign(
0036         strlcpy(__entry->name, bdi_dev_name(bdi),
0037             ARRAY_SIZE(__entry->name));
0038         __entry->rmean      = stat[0].mean;
0039         __entry->rmin       = stat[0].min;
0040         __entry->rmax       = stat[0].max;
0041         __entry->rnr_samples    = stat[0].nr_samples;
0042         __entry->wmean      = stat[1].mean;
0043         __entry->wmin       = stat[1].min;
0044         __entry->wmax       = stat[1].max;
0045         __entry->wnr_samples    = stat[1].nr_samples;
0046     ),
0047 
0048     TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, "
0049           "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu",
0050           __entry->name, __entry->rmean, __entry->rmin, __entry->rmax,
0051           __entry->rnr_samples, __entry->wmean, __entry->wmin,
0052           __entry->wmax, __entry->wnr_samples)
0053 );
0054 
0055 /**
0056  * wbt_lat - trace latency event
0057  * @lat: latency trigger
0058  */
0059 TRACE_EVENT(wbt_lat,
0060 
0061     TP_PROTO(struct backing_dev_info *bdi, unsigned long lat),
0062 
0063     TP_ARGS(bdi, lat),
0064 
0065     TP_STRUCT__entry(
0066         __array(char, name, 32)
0067         __field(unsigned long, lat)
0068     ),
0069 
0070     TP_fast_assign(
0071         strlcpy(__entry->name, bdi_dev_name(bdi),
0072             ARRAY_SIZE(__entry->name));
0073         __entry->lat = div_u64(lat, 1000);
0074     ),
0075 
0076     TP_printk("%s: latency %lluus", __entry->name,
0077             (unsigned long long) __entry->lat)
0078 );
0079 
0080 /**
0081  * wbt_step - trace wb event step
0082  * @msg: context message
0083  * @step: the current scale step count
0084  * @window: the current monitoring window
0085  * @bg: the current background queue limit
0086  * @normal: the current normal writeback limit
0087  * @max: the current max throughput writeback limit
0088  */
0089 TRACE_EVENT(wbt_step,
0090 
0091     TP_PROTO(struct backing_dev_info *bdi, const char *msg,
0092          int step, unsigned long window, unsigned int bg,
0093          unsigned int normal, unsigned int max),
0094 
0095     TP_ARGS(bdi, msg, step, window, bg, normal, max),
0096 
0097     TP_STRUCT__entry(
0098         __array(char, name, 32)
0099         __field(const char *, msg)
0100         __field(int, step)
0101         __field(unsigned long, window)
0102         __field(unsigned int, bg)
0103         __field(unsigned int, normal)
0104         __field(unsigned int, max)
0105     ),
0106 
0107     TP_fast_assign(
0108         strlcpy(__entry->name, bdi_dev_name(bdi),
0109             ARRAY_SIZE(__entry->name));
0110         __entry->msg    = msg;
0111         __entry->step   = step;
0112         __entry->window = div_u64(window, 1000);
0113         __entry->bg = bg;
0114         __entry->normal = normal;
0115         __entry->max    = max;
0116     ),
0117 
0118     TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u",
0119           __entry->name, __entry->msg, __entry->step, __entry->window,
0120           __entry->bg, __entry->normal, __entry->max)
0121 );
0122 
0123 /**
0124  * wbt_timer - trace wb timer event
0125  * @status: timer state status
0126  * @step: the current scale step count
0127  * @inflight: tracked writes inflight
0128  */
0129 TRACE_EVENT(wbt_timer,
0130 
0131     TP_PROTO(struct backing_dev_info *bdi, unsigned int status,
0132          int step, unsigned int inflight),
0133 
0134     TP_ARGS(bdi, status, step, inflight),
0135 
0136     TP_STRUCT__entry(
0137         __array(char, name, 32)
0138         __field(unsigned int, status)
0139         __field(int, step)
0140         __field(unsigned int, inflight)
0141     ),
0142 
0143     TP_fast_assign(
0144         strlcpy(__entry->name, bdi_dev_name(bdi),
0145             ARRAY_SIZE(__entry->name));
0146         __entry->status     = status;
0147         __entry->step       = step;
0148         __entry->inflight   = inflight;
0149     ),
0150 
0151     TP_printk("%s: status=%u, step=%d, inflight=%u", __entry->name,
0152           __entry->status, __entry->step, __entry->inflight)
0153 );
0154 
0155 #endif /* _TRACE_WBT_H */
0156 
0157 /* This part must be outside protection */
0158 #include <trace/define_trace.h>