iocost_monitor: start from the oldest usage index
authorChengming Zhou <zhouchengming@bytedance.com>
Thu, 30 Jul 2020 12:31:04 +0000 (20:31 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Jul 2020 17:45:29 +0000 (11:45 -0600)
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>
tools/cgroup/iocost_monitor.py

index 3c21de88af9e53f589045a8c84d0dff40114c793..f4699f9b46ba763ff992f791f89912f78ba67344 100644 (file)
@@ -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)