From 0d387ea41e64afbb80a4ec5ac0f49327d07bd6d9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 23 Oct 2020 12:33:59 +0200 Subject: ET+Timer: handle start offset between sync pulse and first trace looking pretty good now! --- lib/harness.py | 13 +++++++++++++ lib/loader.py | 11 ++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/harness.py b/lib/harness.py index 04b14eb..3074d25 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -384,6 +384,15 @@ class OnboardTimerHarness(TransitionHarness): new_harness.trace_id = self.trace_id return new_harness + def reset(self): + super().reset() + self.trace_length = 0 + + def set_trace_start_offset(self, start_offset): + if not "start_offset" in self.traces[0]: + self.traces[0]["start_offset"] = list() + self.traces[0]["start_offset"].append(start_offset) + def undo(self, undo_from): """ Undo all benchmark runs starting with index `undo_from`. @@ -402,6 +411,8 @@ class OnboardTimerHarness(TransitionHarness): ] = state_or_transition["offline_aggregates"]["duration"][ :undo_from ] + if "start_offset" in trace: + trace["start_offset"] = trace["start_offset"][:undo_from] def global_code(self): ret = "#define PTALOG_TIMING\n" @@ -591,6 +602,8 @@ class OnboardTimerHarness(TransitionHarness): elif self.current_transition_in_trace == 0 and self.trace_id > 0: prev_state_data = self.traces[self.trace_id - 1]["trace"][-1] else: + if self.current_transition_in_trace == 0 and self.trace_id == 0: + self.set_trace_start_offset(prev_state_duration_us) prev_state_data = None except IndexError: transition_name = None diff --git a/lib/loader.py b/lib/loader.py index 0e46755..649c032 100644 --- a/lib/loader.py +++ b/lib/loader.py @@ -1784,19 +1784,16 @@ class EnergyTraceWithTimer(EnergyTraceWithLogicAnalyzer): # Start "Synchronization pulse" timestamps = [0, 10, 1e6, 1e6 + 10] - # 250ms zwischen Ende der LASync und Beginn der Messungen - # (wegen sleep(250) in der generierten multipass-runLASync-Funktion) - # TODO die prevcycles der allerersten Transition werden vom Tooling nicht - # ausgewertet / weitergereicht, genau diese müssten hier hin. - timestamps.append(timestamps[-1] + 250e3) + # The first trace doesn't start immediately, append offset saved by OnboarTimerHarness + timestamps.append(timestamps[-1] + traces[0]["start_offset"][offline_index]) for tr in traces: for t in tr["trace"]: - # print(t['online_aggregates']['duration'][0]) + # print(t["online_aggregates"]["duration"][offline_index]) timestamps.append( timestamps[-1] + t["online_aggregates"]["duration"][offline_index] ) - print(timestamps) + # print(timestamps) # Stop "Synchronization pulses". The first one has already started. timestamps.extend(np.array([10, 1e6, 1e6 + 10]) + timestamps[-1]) -- cgit v1.2.3