diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-11-25 13:59:32 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-11-25 13:59:32 +0100 |
commit | 1cea59bcc6235dbaa83069f454107664a06f2ab3 (patch) | |
tree | aeb4f745b2d0723597a2bd92299a294a85f173c7 /lib | |
parent | 80633938dad5173e44e387b35e234eadac0759e2 (diff) |
OnboardTimerHarness: Subtract NOP duration from timing data
Diffstat (limited to 'lib')
-rw-r--r-- | lib/harness.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/harness.py b/lib/harness.py index 7a7b898..7a336e5 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -331,6 +331,11 @@ class OnboardTimerHarness(TransitionHarness): def parser_cb(self, line): #print('[HARNESS] got line {}'.format(line)) + res = re.match(r'\[PTA\] nop=(\S+)/(\S+)', line) + if res: + self.nop_cycles = int(res.group(1)) + if int(res.group(2)): + raise RuntimeError('Counter overflow ({:d}/{:d}) during NOP test, wtf?!'.format(res.group(1), res.group(2))) if re.match(r'\[PTA\] benchmark stop', line): self.repetitions += 1 self.synced = False @@ -360,8 +365,9 @@ class OnboardTimerHarness(TransitionHarness): if overflow >= self.counter_max_overflow: self.abort = True raise RuntimeError('Counter overflow ({:d}/{:d}) in benchmark id={:d} trace={:d}: transition #{:d} (ID {:d})'.format(cycles, overflow, 0, self.trace_id, self.current_transition_in_trace, transition_id)) - duration_us = cycles * self.one_cycle_in_us + overflow * self.one_overflow_in_us - # TODO subtract 'nop' cycles + duration_us = cycles * self.one_cycle_in_us + overflow * self.one_overflow_in_us - self.nop_cycles * self.one_cycle_in_us + if duration_us < 0: + duration_us = 0 # self.traces contains transitions and states, UART output only contains transitions -> use index * 2 try: log_data_target = self.traces[self.trace_id]['trace'][self.current_transition_in_trace * 2] |