From f9fa73ba623fda163fb6f177cc326a3eabf522cc Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Fri, 4 Nov 2022 10:25:26 +0000 Subject: [PATCH] lisa.trace: Fix HRTxtTraceParser regex parsing FIX A Systrace generated by the Perfetto's traceconv tool has records with this format: ``` -0 (-----) [000] .... 608397.919018: sched_wakeup: comm=traced pid=403293 prio=120 target_cpu=000 ``` which timestamp gets parsed as `7.919018`, i.e. by ignoring all the digits but one decimal. The regexp also picks up all the spaces before the task name, by ending up with duplicated names when the same task name is parsed also (without space) form an event field (e.g. a `sched_switch`'s `next_comm`) Fix the timestamp parsing by ensuring that, after the `__cpu` filed has been parsed, we skip all and only the non digit chars following it. Fix the command name parsing by ensuring we discard all the space before the name start. --- lisa/trace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisa/trace.py b/lisa/trace.py index e611be7c6..80f183c78 100644 --- a/lisa/trace.py +++ b/lisa/trace.py @@ -1911,7 +1911,7 @@ class HRTxtTraceParser(SimpleTxtTraceParser): ), } - HEADER_REGEX = r'(?P<__comm>.+)-(?P<__pid>\d+)[^[]*\[(?P<__cpu>\d*)\].*(?P<__timestamp>\d+\.\d+): +(?P<__event>\w+):' + HEADER_REGEX = r'\s*(?P<__comm>.+)-(?P<__pid>\d+)[^[]*\[(?P<__cpu>\d*)\][^\d]+(?P<__timestamp>\d+\.\d+): +(?P<__event>\w+):' class SysTraceParser(HRTxtTraceParser): -- GitLab