summaryrefslogtreecommitdiff
path: root/tools/cgroup/iocost_monitor.py
diff options
context:
space:
mode:
authorChengming Zhou <zhouchengming@bytedance.com>2020-07-30 15:31:04 +0300
committerJens Axboe <axboe@kernel.dk>2020-07-30 20:45:29 +0300
commit1bf6ece5731db14f1556637494d2048a8bb15a41 (patch)
treeaa7e182e5cb6d4cd12fbb3145adbaa2faa00858b /tools/cgroup/iocost_monitor.py
parentd9012a59db54442d5b2fcfdfcded35cf566397d3 (diff)
downloadlinux-1bf6ece5731db14f1556637494d2048a8bb15a41.tar.xz
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: Chengming Zhou <zhouchengming@bytedance.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/cgroup/iocost_monitor.py')
-rw-r--r--tools/cgroup/iocost_monitor.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/cgroup/iocost_monitor.py b/tools/cgroup/iocost_monitor.py
index 3c21de88af9e..f4699f9b46ba 100644
--- a/tools/cgroup/iocost_monitor.py
+++ b/tools/cgroup/iocost_monitor.py
@@ -173,7 +173,7 @@ class IocgStat:
self.usages = []
self.usage = 0
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
self.usages.append(upct)
self.usage = max(self.usage, upct)