All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iocost_monitor: start from the oldest usage index
@ 2020-07-30 12:31 Chengming Zhou
  2020-07-30 14:15 ` Tejun Heo
  2020-07-30 17:46 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Chengming Zhou @ 2020-07-30 12:31 UTC (permalink / raw)
  To: tj, axboe, linux-kernel; +Cc: zhouchengming

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iocost_monitor: start from the oldest usage index
  2020-07-30 12:31 [PATCH] iocost_monitor: start from the oldest usage index Chengming Zhou
@ 2020-07-30 14:15 ` Tejun Heo
  2020-07-30 17:46 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2020-07-30 14:15 UTC (permalink / raw)
  To: Chengming Zhou; +Cc: axboe, linux-kernel

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 <zhouchengming@bytedance.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iocost_monitor: start from the oldest usage index
  2020-07-30 12:31 [PATCH] iocost_monitor: start from the oldest usage index Chengming Zhou
  2020-07-30 14:15 ` Tejun Heo
@ 2020-07-30 17:46 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2020-07-30 17:46 UTC (permalink / raw)
  To: Chengming Zhou, tj, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-30 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 12:31 [PATCH] iocost_monitor: start from the oldest usage index Chengming Zhou
2020-07-30 14:15 ` Tejun Heo
2020-07-30 17:46 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.