aboutsummaryrefslogtreecommitdiff
path: root/wa/utils
diff options
context:
space:
mode:
authorSergei Trofimov <sergei.trofimov@arm.com>2018-05-11 15:45:25 +0100
committerMarc Bonnici <marc.bonnici@arm.com>2018-05-14 17:05:06 +0100
commite7e272cd036c19d6a9830d59331b4cfdf5686171 (patch)
tree9511eeab0609d56d69e79ad1aa21407144aabd5f /wa/utils
parent795b3485ce18b56946300215403de7485af5c488 (diff)
utils/trace_cmd: add trace_has_marker()
Add a function to check whether a trace file contains start/stop markers (actually only check for start marker -- stop marker is assumed).
Diffstat (limited to 'wa/utils')
-rw-r--r--wa/utils/trace_cmd.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/wa/utils/trace_cmd.py b/wa/utils/trace_cmd.py
index b308f41a..8eaf4d59 100644
--- a/wa/utils/trace_cmd.py
+++ b/wa/utils/trace_cmd.py
@@ -325,3 +325,12 @@ class TraceCmdParser(object):
body_parser = regex_body_parser(body_parser)
yield TraceCmdEvent(parser=body_parser, **match.groupdict())
+
+def trace_has_marker(filepath, max_lines_to_check=2000000):
+ with open(filepath) as fh:
+ for i, line in enumerate(fh):
+ if TRACE_MARKER_START in line:
+ return True
+ if i >= max_lines_to_check:
+ break
+ return False