All of lore.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punitagrawal@gmail.com>
To: jkacur@redhat.com
Cc: Punit Agrawal <punitagrawal@gmail.com>,
	linux-rt-users@vger.kernel.org, punit1.agrawal@toshiba.co.jp,
	Venkata.Pyla@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com
Subject: [PATCH 3/3] rteval: misc.py: Sort the list of cpus returned by online_cpus()
Date: Thu,  2 Sep 2021 18:24:52 +0900	[thread overview]
Message-ID: <20210902092452.726905-4-punitagrawal@gmail.com> (raw)
In-Reply-To: <20210902092452.726905-1-punitagrawal@gmail.com>

From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>

online_cpus() returns a list of online cpus in arbitrary order. e.g.,
on a hexacore system it returns -

    ['5', '3', '1', '4', '2', '0']

Generally this wouldn't be a problem but the cyclictest.py module
matches the unsorted list with the latencies output by "cyclictest"
which are ordered by core number. This leads to incorrect reporting of
per-core latencies in the final report generated by rteval. The issue
was noticed when comparing the rteval report with cyclictest logs
(enabled by a recent change).

Fix the inconsistency in core numbering by sorting the list of cpus
returned by online_cpus(). As the cpus are represented as a string,
sort with the integer key to avoid issues on systems with large number
of cores.

Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
---
 rteval/misc.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rteval/misc.py b/rteval/misc.py
index 0dd361ff19fd..ec3641e4a013 100644
--- a/rteval/misc.py
+++ b/rteval/misc.py
@@ -53,6 +53,7 @@ def online_cpus():
         for c in glob.glob('/sys/devices/system/cpu/cpu[0-9]*'):
             num = str(c.replace('/sys/devices/system/cpu/cpu', ''))
             online_cpus.append(num)
+    online_cpus.sort(key=int)
     return online_cpus
 
 def invert_cpulist(cpulist):
-- 
2.32.0


  parent reply	other threads:[~2021-09-02  9:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  9:24 [PATCH 0/3] rteval: Fix issues with cyclictest.py module Punit Agrawal
2021-09-02  9:24 ` [PATCH 1/3] rteval: cyclictest.py Enable logging cyclictest output Punit Agrawal
2021-09-12 15:03   ` John Kacur
2021-09-02  9:24 ` [PATCH 2/3] rteval: cyclictest.py Parse max latencies from cyclictest ouput Punit Agrawal
2021-09-02  9:24 ` Punit Agrawal [this message]
2021-09-12 15:39   ` [PATCH 3/3] rteval: misc.py: Sort the list of cpus returned by online_cpus() John Kacur
2021-09-08 14:19 ` [PATCH 0/3] rteval: Fix issues with cyclictest.py module Punit Agrawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210902092452.726905-4-punitagrawal@gmail.com \
    --to=punitagrawal@gmail.com \
    --cc=Venkata.Pyla@toshiba-tsip.com \
    --cc=dinesh.kumar@toshiba-tsip.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=punit1.agrawal@toshiba.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.