diff options
Diffstat (limited to 'lib/loader')
-rw-r--r-- | lib/loader/energytrace.py | 9 | ||||
-rw-r--r-- | lib/loader/generic.py | 12 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/loader/energytrace.py b/lib/loader/energytrace.py index 0ffaac7..0386b99 100644 --- a/lib/loader/energytrace.py +++ b/lib/loader/energytrace.py @@ -680,6 +680,15 @@ class EnergyTraceWithLogicAnalyzer(ExternalTimerSync): self.sync_data = self.sync_data[:x] break + # Each synchronization pulse consists of two LogicAnalyzer pulses, so four + # entries in time_stamp_data (rising edge, falling edge, rising edge, falling edge). + # If we have less then twelve entries, we observed no transitions and don't even have + # valid synchronization data. In this case, we bail out. + if len(self.sync_data) < 12: + raise RuntimeError( + f"LogicAnalyzer sync data has length {len(time_stamp_data)}, expected >= 12" + ) + self.online_timestamps = self.sync_data[2:3] + self.sync_data[4:-7] self.online_timestamps = ( np.array(self.online_timestamps) - self.online_timestamps[0] diff --git a/lib/loader/generic.py b/lib/loader/generic.py index 78305e0..67535bc 100644 --- a/lib/loader/generic.py +++ b/lib/loader/generic.py @@ -29,6 +29,17 @@ class ExternalTimerSync: if os.getenv("DFATOOL_COMPENSATE_DRIFT"): import dfatool.drift + if len(self.hw_statechange_indexes): + # measurement was performed with EnergyTrace++ + # (i.e., with cpu state annotations) + return dfatool.drift.compensate_etplusplus( + data, + timestamps, + event_timestamps, + self.hw_statechange_indexes, + offline_index=offline_index, + ) + return dfatool.drift.compensate( data, timestamps, event_timestamps, offline_index=offline_index ) @@ -41,6 +52,7 @@ class ExternalTimerSync: # * self.sync_min_high_count, self.sync_min_low_count: outlier handling in synchronization pulse detection # * self.sync_power, self.sync_min_duration: synchronization pulse parameters. one pulse before the measurement, two pulses afterwards # expected_trace must contain online timestamps + # TODO automatically determine sync_power if it is None def analyze_states(self, expected_trace, repeat_id, online_timestamps=None): """ :param online_timestamps: must start at 0, if set |