From: Chengming Zhou Date: Thu, 30 Jul 2020 12:31:04 +0000 (+0800) Subject: iocost_monitor: start from the oldest usage index X-Git-Tag: sched-urgent-2020-08-15~62^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1bf6ece5731db14f1556637494d2048a8bb15a41;p=users%2Fdwmw2%2Flinux.git 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 Acked-by: Tejun Heo Signed-off-by: Jens Axboe --- diff --git a/tools/cgroup/iocost_monitor.py b/tools/cgroup/iocost_monitor.py index 3c21de88af9e5..f4699f9b46ba7 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)