All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>
To: linux-rt-users@vger.kernel.org, John Kacur <jkacur@redhat.com>,
	Clark Williams <williams@redhat.com>
Subject: [PATCH] hwlatdetect: correctly get CPU number from different sample formats
Date: Fri, 13 Feb 2026 14:57:25 -0300	[thread overview]
Message-ID: <aY9mBeyzm5Mae7SH@redhat.com> (raw)

Make hwlatdetect able to get the CPU number from samples in both
'nolatency-format' (currently covered by the code) and also from
samples in 'latency-format'.

With this change the code is now able to get the CPU from samples
in the following formats:

- nolatency-format:
   <...>-3820    [007] d.... 22851.463472: #2     inner/outer(us):    0/233   ts:1770937572.925294075 count:1
   <...>-3820    [011] d.... 22855.495526: #3     inner/outer(us):  308/305   ts:1770937576.805213360 count:49

- latency-format:
   <...>-3835     13d.... 12608167us : #2     inner/outer(us):  307/299   ts:1770937629.988530678 count:49
   <...>-3835     16d.... 15632212us : #3     inner/outer(us):  308/296   ts:1770937633.322710076 count:24

Fixes: 96e780938322 ("rt-tests: hwlatdetect: Add field cpu to samples output")
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
---
 src/hwlatdetect/hwlatdetect.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index 68f312db639f..26694abe099a 100755
--- a/src/hwlatdetect/hwlatdetect.py
+++ b/src/hwlatdetect/hwlatdetect.py
@@ -246,7 +246,7 @@ class Tracer(Detector):
 
         def __init__(self, line):
             fields = line.split()
-            self.cpu = int(fields[1][1:-1])
+            self.cpu = int(fields[1][1:-1]) if fields[1][0] == '[' else int(fields[1][:-5])
             i, o = fields[6].split('/')
             ts = fields[7][3:]
             self.timestamp = str(ts)
-- 
2.53.0


             reply	other threads:[~2026-02-13 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 17:57 Luis Claudio R. Goncalves [this message]
2026-02-19 18:24 ` [PATCH] hwlatdetect: correctly get CPU number from different sample formats John Kacur

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=aY9mBeyzm5Mae7SH@redhat.com \
    --to=lgoncalv@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /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.