From 9372ca24757ebd5dbd7ba5ae8b49472f2c2ce521 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 19 Jul 2019 14:19:42 +0200 Subject: generate-dfa-benchmark: Add trace filter --- lib/harness.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'lib/harness.py') diff --git a/lib/harness.py b/lib/harness.py index ade42d6..529a77e 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -3,6 +3,7 @@ Harnesses for various types of benchmark logs. tbd """ +import subprocess import re # TODO prepare benchmark log JSON with parameters etc. @@ -16,6 +17,12 @@ class TransitionHarness: self.trace_id = 1 pass + def start_benchmark(self): + pass + + def stop_benchmark(self): + pass + def global_code(self): ret = '' if self.gpio_pin != None: @@ -44,11 +51,12 @@ class TransitionHarness: 'parameter': param, }) - def append_transition(self, transition_name, param): + def append_transition(self, transition_name, param, args = []): self.traces[-1]['trace'].append({ 'name': transition_name, 'isa': 'transition', 'parameter': param, + 'args' : args, }) def start_run(self): @@ -61,23 +69,26 @@ class TransitionHarness: ret += 'ptalog.stopTransition();\n' return ret - def stop_run(self): - return 'ptalog.dump();\n' + def stop_run(self, trace_id = 0): + return 'ptalog.dump({:d});\n'.format(trace_id) def stop_benchmark(self): return '' + def parser_cb(self, line): + pass + def parse_log(self, lines): sync = False for line in lines: print(line) - res = re.fullmatch('\[PTA\] (.*=.*)', line) - if re.fullmatch('\[PTA\] benchmark start, id=(.*)', line): + res = re.fullmatch(r'\[PTA\] (.*=.*)', line) + if re.fullmatch(r'\[PTA\] benchmark start, id=(.*)', line): print('> got sync') sync = True elif not sync: continue - elif re.fullmatch('\[PTA\] trace, count=(.*)', line): + elif re.fullmatch(r'\[PTA\] trace, count=(.*)', line): print('> got transition') pass elif res: @@ -108,4 +119,4 @@ class OnboardTimerHarness(TransitionHarness): ret += '{}\n'.format(transition_code) ret += 'counter.stop();\n' ret += 'ptalog.stopTransition(counter);\n' - return ret + return ret \ No newline at end of file -- cgit v1.2.3