From d38c3a191c44806d87584b7bd6052072820bcea3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 15 Aug 2019 11:49:05 +0200 Subject: Fix generate-dfa-benchmark leaving out benchmark parts when splitting runs --- lib/dfatool.py | 2 +- lib/harness.py | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/dfatool.py b/lib/dfatool.py index e318e81..528eabc 100755 --- a/lib/dfatool.py +++ b/lib/dfatool.py @@ -537,7 +537,7 @@ class TimingData: for filename in self.filenames: with open(filename, 'r') as f: log_data = json.load(f) - self.traces_by_fileno.append(log_data['traces']) + self.traces_by_fileno.extend(log_data['traces']) self._concatenate_analyzed_traces() def get_preprocessed_data(self, verbose = True): diff --git a/lib/harness.py b/lib/harness.py index 020bc72..af74977 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -11,15 +11,30 @@ import re # generated otherwise and it should also work with AnalyticModel (which does # not have states) class TransitionHarness: + """Foo.""" def __init__(self, gpio_pin = None, pta = None, log_return_values = False): + """ + Create a new TransitionHarness + + :param gpio_pin: multipass GPIO Pin used for transition synchronization, e.g. `GPIO::p1_0`. Optional. + The GPIO output is high iff a transition is executing + :param pta: PTA object + :param log_return_values: Log return values of transition function calls? + """ self.gpio_pin = gpio_pin self.pta = pta self.log_return_values = log_return_values self.reset() + def copy(self): + new_object = __class__(gpio_pin = self.gpio_pin, pta = self.pta, log_return_values = self.log_return_values) + new_object.traces = self.traces.copy() + new_object.trace_id = self.trace_id + return new_object + def reset(self): self.traces = [] - self.trace_id = 1 + self.trace_id = 0 self.synced = False def global_code(self): @@ -102,12 +117,18 @@ class TransitionHarness: pass class OnboardTimerHarness(TransitionHarness): + """Bar.""" def __init__(self, counter_limits, **kwargs): super().__init__(**kwargs) - self.trace_id = 0 self.trace_length = 0 self.one_cycle_in_us, self.one_overflow_in_us, self.counter_max_overflow = counter_limits + def copy(self): + new_harness = __class__((self.one_cycle_in_us, self.one_overflow_in_us, self.counter_max_overflow), gpio_pin = self.gpio_pin, pta = self.pta, log_return_values = self.log_return_values) + new_harness.traces = self.traces.copy() + new_harness.trace_id = self.trace_id + return new_harness + def global_code(self): ret = '#include "driver/counter.h"\n' ret += '#define PTALOG_TIMING\n' -- cgit v1.2.3