From 71a13969550a4ca41c2599a0e40a5d8f1dc425ed Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 9 Mar 2021 11:07:19 +0100 Subject: [PATCH] ds: parse time with perf generator --- garlic/ds/perf/stat.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/garlic/ds/perf/stat.py b/garlic/ds/perf/stat.py index ac180fe..a6d69bc 100644 --- a/garlic/ds/perf/stat.py +++ b/garlic/ds/perf/stat.py @@ -26,6 +26,25 @@ def process_run(tree, runPath): tree['perf'] = perf_data + with open("stdout.log", "r") as f: + lines = [line.strip() for line in f.readlines()] + + time_line = None + for line in lines: + + if re.match(r'^ ?time .*', line): + time_line = line + break + + if time_line is None: + eprint("missing time line, aborting") + eprint("stdout file = {}/stdout.log".format(runPath)) + exit(1) + + time_str = time_line.split()[1] + + tree['time'] = float(time_str) + print(json.dumps(tree)) def process_result_tree(resultTree):