2020-07-30 12:33:49

by Chengming Zhou

[permalink] [raw]
Subject: [PATCH] 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 <[email protected]>
---
tools/cgroup/iocost_monitor.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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)
--
2.20.1


2020-07-30 14:16:12

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH] iocost_monitor: start from the oldest usage index

On Thu, Jul 30, 2020 at 08:31:04PM +0800, Chengming Zhou wrote:
> 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 <[email protected]>

Acked-by: Tejun Heo <[email protected]>

Thanks.

--
tejun

2020-07-30 17:49:14

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] iocost_monitor: start from the oldest usage index

On 7/30/20 6:31 AM, Chengming Zhou wrote:
> iocg usage_idx is the latest usage index, we should start from the
> oldest usage index to show the consecutive NR_USAGE_SLOTS usages.

Applied, thanks.

--
Jens Axboe