summaryrefslogtreecommitdiff
path: root/lib/harness.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-07-19 14:19:42 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-07-19 14:19:42 +0200
commit9372ca24757ebd5dbd7ba5ae8b49472f2c2ce521 (patch)
treebc858ddfebb1d10db2c1b805aef857ee83386adf /lib/harness.py
parent29acf1f00f52235dce3dc7397cecd0127c90b22a (diff)
generate-dfa-benchmark: Add trace filter
Diffstat (limited to 'lib/harness.py')
-rw-r--r--lib/harness.py25
1 files changed, 18 insertions, 7 deletions
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