Commit 1bf6ece5 authored by Chengming Zhou's avatar Chengming Zhou Committed by Jens Axboe

iocost_monitor: start from the oldest usage index

iocg usage_idx is the latest usage index, we should start from the
oldest usage index to show the consecutive NR_USAGE_SLOTS usages.
Signed-off-by: default avatarChengming Zhou <zhouchengming@bytedance.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent d9012a59
...@@ -173,7 +173,7 @@ class IocgStat: ...@@ -173,7 +173,7 @@ class IocgStat:
self.usages = [] self.usages = []
self.usage = 0 self.usage = 0
for i in range(NR_USAGE_SLOTS): for i in range(NR_USAGE_SLOTS):
usage = iocg.usages[(usage_idx + i) % NR_USAGE_SLOTS].value_() usage = iocg.usages[(usage_idx + 1 + i) % NR_USAGE_SLOTS].value_()
upct = usage * 100 / HWEIGHT_WHOLE upct = usage * 100 / HWEIGHT_WHOLE
self.usages.append(upct) self.usages.append(upct)
self.usage = max(self.usage, upct) self.usage = max(self.usage, upct)
......
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