summaryrefslogtreecommitdiff
path: root/lib/harness.py
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-13 10:58:56 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-13 10:58:56 +0100
commit0c132a304eb001dcd7ff9ee578854c92686fe15b (patch)
tree156615f7ffb4b9dc36fe5a648d5b919a836bc801 /lib/harness.py
parent28d33c2006b88c40d9ff068f2ea3baa8ed6db44f (diff)
WiP
Diffstat (limited to 'lib/harness.py')
-rw-r--r--lib/harness.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/harness.py b/lib/harness.py
index 1eb294b..2705193 100644
--- a/lib/harness.py
+++ b/lib/harness.py
@@ -4,9 +4,15 @@ Harnesses for various types of benchmark logs.
tbd
"""
+# TODO prepare benchmark log JSON with parameters etc.
+# Should be independent of PTA class, as benchmarks may also be
+# generated otherwise and it should also work with AnalyticModel (which does
+# not have states)
class TransitionHarness:
def __init__(self, gpio_pin = None):
self.gpio_pin = gpio_pin
+ self.traces = []
+ self.trace_id = 1
pass
def global_code(self):
@@ -23,10 +29,27 @@ class TransitionHarness:
def start_benchmark(self):
return 'ptalog.startBenchmark(0);\n'
+ def start_trace(self):
+ self.traces.append({
+ 'id' : self.trace_id,
+ 'trace' : [{
+ 'name' : 'UNINITIALIZED',
+ 'isa' : 'state',
+ 'parameter' : dict(),
+ 'offline_aggregates' : list(),
+ }]
+ })
+ self.trace_id += 1
+
+ #def append_state(self):
+
+ #def append_transition(self, ):
+
def start_run(self):
+ self.start_trace()
return 'ptalog.reset();\n'
- def pass_transition(self, transition_id, transition_code):
+ def pass_transition(self, transition_id, transition_code, parameter = dict()):
ret = 'ptalog.passTransition({:d});\n'.format(transition_id)
ret += 'ptalog.startTransition();\n'
ret += '{}\n'.format(transition_code)
@@ -56,7 +79,7 @@ class OnboardTimerHarness(TransitionHarness):
ret += super().start_benchmark()
return ret
- def pass_transition(self, transition_id, transition_code):
+ def pass_transition(self, transition_id, transition_code, parameter = dict()):
ret = 'ptalog.passTransition({:d});\n'.format(transition_id)
ret += 'ptalog.startTransition();\n'
ret += 'counter.start();\n'