Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM iocost
0004 
0005 struct ioc;
0006 struct ioc_now;
0007 struct ioc_gq;
0008 
0009 #if !defined(_TRACE_BLK_IOCOST_H) || defined(TRACE_HEADER_MULTI_READ)
0010 #define _TRACE_BLK_IOCOST_H
0011 
0012 #include <linux/tracepoint.h>
0013 
0014 DECLARE_EVENT_CLASS(iocost_iocg_state,
0015 
0016     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0017         u64 last_period, u64 cur_period, u64 vtime),
0018 
0019     TP_ARGS(iocg, path, now, last_period, cur_period, vtime),
0020 
0021     TP_STRUCT__entry (
0022         __string(devname, ioc_name(iocg->ioc))
0023         __string(cgroup, path)
0024         __field(u64, now)
0025         __field(u64, vnow)
0026         __field(u64, vrate)
0027         __field(u64, last_period)
0028         __field(u64, cur_period)
0029         __field(u64, vtime)
0030         __field(u32, weight)
0031         __field(u32, inuse)
0032         __field(u64, hweight_active)
0033         __field(u64, hweight_inuse)
0034     ),
0035 
0036     TP_fast_assign(
0037         __assign_str(devname, ioc_name(iocg->ioc));
0038         __assign_str(cgroup, path);
0039         __entry->now = now->now;
0040         __entry->vnow = now->vnow;
0041         __entry->vrate = now->vrate;
0042         __entry->last_period = last_period;
0043         __entry->cur_period = cur_period;
0044         __entry->vtime = vtime;
0045         __entry->weight = iocg->weight;
0046         __entry->inuse = iocg->inuse;
0047         __entry->hweight_active = iocg->hweight_active;
0048         __entry->hweight_inuse = iocg->hweight_inuse;
0049     ),
0050 
0051     TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
0052           "period=%llu->%llu vtime=%llu "
0053           "weight=%u/%u hweight=%llu/%llu",
0054         __get_str(devname), __get_str(cgroup),
0055         __entry->now, __entry->vnow, __entry->vrate,
0056         __entry->last_period, __entry->cur_period,
0057         __entry->vtime, __entry->inuse, __entry->weight,
0058         __entry->hweight_inuse, __entry->hweight_active
0059     )
0060 );
0061 
0062 DEFINE_EVENT(iocost_iocg_state, iocost_iocg_activate,
0063     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0064          u64 last_period, u64 cur_period, u64 vtime),
0065 
0066     TP_ARGS(iocg, path, now, last_period, cur_period, vtime)
0067 );
0068 
0069 DEFINE_EVENT(iocost_iocg_state, iocost_iocg_idle,
0070     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0071          u64 last_period, u64 cur_period, u64 vtime),
0072 
0073     TP_ARGS(iocg, path, now, last_period, cur_period, vtime)
0074 );
0075 
0076 DECLARE_EVENT_CLASS(iocg_inuse_update,
0077 
0078     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0079         u32 old_inuse, u32 new_inuse,
0080         u64 old_hw_inuse, u64 new_hw_inuse),
0081 
0082     TP_ARGS(iocg, path, now, old_inuse, new_inuse,
0083         old_hw_inuse, new_hw_inuse),
0084 
0085     TP_STRUCT__entry (
0086         __string(devname, ioc_name(iocg->ioc))
0087         __string(cgroup, path)
0088         __field(u64, now)
0089         __field(u32, old_inuse)
0090         __field(u32, new_inuse)
0091         __field(u64, old_hweight_inuse)
0092         __field(u64, new_hweight_inuse)
0093     ),
0094 
0095     TP_fast_assign(
0096         __assign_str(devname, ioc_name(iocg->ioc));
0097         __assign_str(cgroup, path);
0098         __entry->now = now->now;
0099         __entry->old_inuse = old_inuse;
0100         __entry->new_inuse = new_inuse;
0101         __entry->old_hweight_inuse = old_hw_inuse;
0102         __entry->new_hweight_inuse = new_hw_inuse;
0103     ),
0104 
0105     TP_printk("[%s:%s] now=%llu inuse=%u->%u hw_inuse=%llu->%llu",
0106         __get_str(devname), __get_str(cgroup), __entry->now,
0107         __entry->old_inuse, __entry->new_inuse,
0108         __entry->old_hweight_inuse, __entry->new_hweight_inuse
0109     )
0110 );
0111 
0112 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_shortage,
0113 
0114     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0115         u32 old_inuse, u32 new_inuse,
0116         u64 old_hw_inuse, u64 new_hw_inuse),
0117 
0118     TP_ARGS(iocg, path, now, old_inuse, new_inuse,
0119         old_hw_inuse, new_hw_inuse)
0120 );
0121 
0122 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_transfer,
0123 
0124     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0125         u32 old_inuse, u32 new_inuse,
0126         u64 old_hw_inuse, u64 new_hw_inuse),
0127 
0128     TP_ARGS(iocg, path, now, old_inuse, new_inuse,
0129         old_hw_inuse, new_hw_inuse)
0130 );
0131 
0132 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_adjust,
0133 
0134     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0135         u32 old_inuse, u32 new_inuse,
0136         u64 old_hw_inuse, u64 new_hw_inuse),
0137 
0138     TP_ARGS(iocg, path, now, old_inuse, new_inuse,
0139         old_hw_inuse, new_hw_inuse)
0140 );
0141 
0142 TRACE_EVENT(iocost_ioc_vrate_adj,
0143 
0144     TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
0145         u32 rq_wait_pct, int nr_lagging, int nr_shortages),
0146 
0147     TP_ARGS(ioc, new_vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages),
0148 
0149     TP_STRUCT__entry (
0150         __string(devname, ioc_name(ioc))
0151         __field(u64, old_vrate)
0152         __field(u64, new_vrate)
0153         __field(int, busy_level)
0154         __field(u32, read_missed_ppm)
0155         __field(u32, write_missed_ppm)
0156         __field(u32, rq_wait_pct)
0157         __field(int, nr_lagging)
0158         __field(int, nr_shortages)
0159     ),
0160 
0161     TP_fast_assign(
0162         __assign_str(devname, ioc_name(ioc));
0163         __entry->old_vrate = atomic64_read(&ioc->vtime_rate);
0164         __entry->new_vrate = new_vrate;
0165         __entry->busy_level = ioc->busy_level;
0166         __entry->read_missed_ppm = missed_ppm[READ];
0167         __entry->write_missed_ppm = missed_ppm[WRITE];
0168         __entry->rq_wait_pct = rq_wait_pct;
0169         __entry->nr_lagging = nr_lagging;
0170         __entry->nr_shortages = nr_shortages;
0171     ),
0172 
0173     TP_printk("[%s] vrate=%llu->%llu busy=%d missed_ppm=%u:%u rq_wait_pct=%u lagging=%d shortages=%d",
0174         __get_str(devname), __entry->old_vrate, __entry->new_vrate,
0175         __entry->busy_level,
0176         __entry->read_missed_ppm, __entry->write_missed_ppm,
0177         __entry->rq_wait_pct, __entry->nr_lagging, __entry->nr_shortages
0178     )
0179 );
0180 
0181 TRACE_EVENT(iocost_iocg_forgive_debt,
0182 
0183     TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
0184         u32 usage_pct, u64 old_debt, u64 new_debt,
0185         u64 old_delay, u64 new_delay),
0186 
0187     TP_ARGS(iocg, path, now, usage_pct,
0188         old_debt, new_debt, old_delay, new_delay),
0189 
0190     TP_STRUCT__entry (
0191         __string(devname, ioc_name(iocg->ioc))
0192         __string(cgroup, path)
0193         __field(u64, now)
0194         __field(u64, vnow)
0195         __field(u32, usage_pct)
0196         __field(u64, old_debt)
0197         __field(u64, new_debt)
0198         __field(u64, old_delay)
0199         __field(u64, new_delay)
0200     ),
0201 
0202     TP_fast_assign(
0203         __assign_str(devname, ioc_name(iocg->ioc));
0204         __assign_str(cgroup, path);
0205         __entry->now = now->now;
0206         __entry->vnow = now->vnow;
0207         __entry->usage_pct = usage_pct;
0208         __entry->old_debt = old_debt;
0209         __entry->new_debt = new_debt;
0210         __entry->old_delay = old_delay;
0211         __entry->new_delay = new_delay;
0212     ),
0213 
0214     TP_printk("[%s:%s] now=%llu:%llu usage=%u debt=%llu->%llu delay=%llu->%llu",
0215         __get_str(devname), __get_str(cgroup),
0216         __entry->now, __entry->vnow, __entry->usage_pct,
0217         __entry->old_debt, __entry->new_debt,
0218         __entry->old_delay, __entry->new_delay
0219     )
0220 );
0221 
0222 #endif /* _TRACE_BLK_IOCOST_H */
0223 
0224 /* This part must be outside protection */
0225 #include <trace/define_trace.h>