mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-21 18:18:41 +00:00
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).
This commit is contained in:
parent
795b3485ce
commit
e7e272cd03
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user