1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 20:38:57 +00:00

trace_cmd: handle trace headers and thread names with spaces

This commit is contained in:
Sergei Trofimov 2015-08-17 12:37:58 +01:00
parent 25c0fd7b8b
commit 95c3f049fb

View File

@ -173,9 +173,11 @@ def regex_body_parser(regex, flags=0):
EVENT_PARSER_MAP = {
}
TRACE_EVENT_REGEX = re.compile(r'^\s+(?P<thread>\S+)\s+\[(?P<cpu_id>\d+)\]\s+(?P<ts>[\d.]+):\s+'
TRACE_EVENT_REGEX = re.compile(r'^\s+(?P<thread>\S+.*?\S+)\s+\[(?P<cpu_id>\d+)\]\s+(?P<ts>[\d.]+):\s+'
r'(?P<name>[^:]+):\s+(?P<body>.*?)\s*$')
HEADER_REGEX = re.compile(r'^\s*(?:version|cpus)\s*=\s*([\d.]+)\s*$')
DROPPED_EVENTS_REGEX = re.compile(r'CPU:(?P<cpu_id>\d+) \[\d*\s*EVENTS DROPPED\]')
@ -217,6 +219,11 @@ class TraceCmdTrace(object):
yield DroppedEventsEvent(match.group('cpu_id'))
continue
match = HEADER_REGEX.search(line)
if match:
logger.debug(line.strip())
continue
match = TRACE_EVENT_REGEX.search(line)
if not match:
logger.warning('Invalid trace event: "{}"'.format(line))