[PATCH] hwlatdetect: correctly get CPU number from different sample formats
"Luis Claudio R. Goncalves" <[email protected]>
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]>
---
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