Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iocost_monitor: improve it by adding iocg wait_ms

The iocg can have three throttled metrics: wait, debt, delay. This patch
add missing wait_ms to IocgStat to show the latest wait_ms of iocg.

As we are here, group iocg usage percents "inflt%" and "usage%" together,
and group iocg throttled metrics "wait", "debt" and "delay" together.

Effect after changes:

nvme0n1 RUN per=50.0ms cur_per=177105.713:v1053528.587 busy= +0 vrate=135.00%:270.00% params=ssd_dfl(CQ)
active weight hweight% inflt% usage% wait debt delay
InterfererGroup0 * 100/ 100 54.28/ 9.09 0.34 24.07 0.00 0.00 0.00
interfered * 84/ 1000 45.72/ 90.91 0.48 41.09 0.00 0.00 0.00

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230804065039.8885-3-chengming.zhou@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Chengming Zhou and committed by
Jens Axboe
68392b00 8e93c1ac

+8 -4
+8 -4
tools/cgroup/iocost_monitor.py
··· 138 138 139 139 def table_header_str(self): 140 140 return f'{"":25} active {"weight":>9} {"hweight%":>13} {"inflt%":>6} ' \ 141 - f'{"debt":>7} {"delay":>7} {"usage%"}' 141 + f'{"usage%":>6} {"wait":>7} {"debt":>7} {"delay":>7}' 142 142 143 143 class IocgStat: 144 144 def __init__(self, iocg): ··· 164 164 165 165 self.usage = (100 * iocg.usage_delta_us.value_() / 166 166 ioc.period_us.value_()) if self.active else 0 167 + self.wait_ms = (iocg.stat.wait_us.value_() - 168 + iocg.last_stat.wait_us.value_()) / 1000 167 169 self.debt_ms = iocg.abs_vdebt.value_() / VTIME_PER_USEC / 1000 168 170 if blkg.use_delay.counter.value_() != 0: 169 171 self.delay_ms = blkg.delay_nsec.counter.value_() / 1_000_000 ··· 182 180 'hweight_active_pct' : self.hwa_pct, 183 181 'hweight_inuse_pct' : self.hwi_pct, 184 182 'inflight_pct' : self.inflight_pct, 183 + 'usage_pct' : self.usage, 184 + 'wait_ms' : self.wait_ms, 185 185 'debt_ms' : self.debt_ms, 186 186 'delay_ms' : self.delay_ms, 187 - 'usage_pct' : self.usage, 188 187 'address' : self.address } 189 188 return out 190 189 ··· 195 192 f'{round(self.inuse):5}/{round(self.active):5} ' \ 196 193 f'{self.hwi_pct:6.2f}/{self.hwa_pct:6.2f} ' \ 197 194 f'{self.inflight_pct:6.2f} ' \ 195 + f'{min(self.usage, 999):6.2f} ' \ 196 + f'{self.wait_ms:7.2f} ' \ 198 197 f'{self.debt_ms:7.2f} ' \ 199 - f'{self.delay_ms:7.2f} '\ 200 - f'{min(self.usage, 999):6.2f}' 198 + f'{self.delay_ms:7.2f}' 201 199 out = out.rstrip(':') 202 200 return out 203 201