Commit 68392b00 authored by Chengming Zhou's avatar Chengming Zhou Committed by Jens Axboe

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: default avatarChengming Zhou <zhouchengming@bytedance.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230804065039.8885-3-chengming.zhou@linux.devSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8e93c1ac
...@@ -138,7 +138,7 @@ class IocStat: ...@@ -138,7 +138,7 @@ class IocStat:
def table_header_str(self): def table_header_str(self):
return f'{"":25} active {"weight":>9} {"hweight%":>13} {"inflt%":>6} ' \ return f'{"":25} active {"weight":>9} {"hweight%":>13} {"inflt%":>6} ' \
f'{"debt":>7} {"delay":>7} {"usage%"}' f'{"usage%":>6} {"wait":>7} {"debt":>7} {"delay":>7}'
class IocgStat: class IocgStat:
def __init__(self, iocg): def __init__(self, iocg):
...@@ -164,6 +164,8 @@ class IocgStat: ...@@ -164,6 +164,8 @@ class IocgStat:
self.usage = (100 * iocg.usage_delta_us.value_() / self.usage = (100 * iocg.usage_delta_us.value_() /
ioc.period_us.value_()) if self.active else 0 ioc.period_us.value_()) if self.active else 0
self.wait_ms = (iocg.stat.wait_us.value_() -
iocg.last_stat.wait_us.value_()) / 1000
self.debt_ms = iocg.abs_vdebt.value_() / VTIME_PER_USEC / 1000 self.debt_ms = iocg.abs_vdebt.value_() / VTIME_PER_USEC / 1000
if blkg.use_delay.counter.value_() != 0: if blkg.use_delay.counter.value_() != 0:
self.delay_ms = blkg.delay_nsec.counter.value_() / 1_000_000 self.delay_ms = blkg.delay_nsec.counter.value_() / 1_000_000
...@@ -180,9 +182,10 @@ class IocgStat: ...@@ -180,9 +182,10 @@ class IocgStat:
'hweight_active_pct' : self.hwa_pct, 'hweight_active_pct' : self.hwa_pct,
'hweight_inuse_pct' : self.hwi_pct, 'hweight_inuse_pct' : self.hwi_pct,
'inflight_pct' : self.inflight_pct, 'inflight_pct' : self.inflight_pct,
'usage_pct' : self.usage,
'wait_ms' : self.wait_ms,
'debt_ms' : self.debt_ms, 'debt_ms' : self.debt_ms,
'delay_ms' : self.delay_ms, 'delay_ms' : self.delay_ms,
'usage_pct' : self.usage,
'address' : self.address } 'address' : self.address }
return out return out
...@@ -192,9 +195,10 @@ class IocgStat: ...@@ -192,9 +195,10 @@ class IocgStat:
f'{round(self.inuse):5}/{round(self.active):5} ' \ f'{round(self.inuse):5}/{round(self.active):5} ' \
f'{self.hwi_pct:6.2f}/{self.hwa_pct:6.2f} ' \ f'{self.hwi_pct:6.2f}/{self.hwa_pct:6.2f} ' \
f'{self.inflight_pct:6.2f} ' \ f'{self.inflight_pct:6.2f} ' \
f'{min(self.usage, 999):6.2f} ' \
f'{self.wait_ms:7.2f} ' \
f'{self.debt_ms:7.2f} ' \ f'{self.debt_ms:7.2f} ' \
f'{self.delay_ms:7.2f} '\ f'{self.delay_ms:7.2f}'
f'{min(self.usage, 999):6.2f}'
out = out.rstrip(':') out = out.rstrip(':')
return out return out
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment