From c4598ca93a72d5176d4488813d38abcaad571123 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 8 Jul 2020 14:47:53 +0200 Subject: analyze-archive: show EnergyTrace sync mode --- bin/analyze-archive.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index 908915c..74a2d41 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -377,7 +377,9 @@ if __name__ == "__main__": if raw_data.version <= 1: data_source = "MIMOSA" elif raw_data.version == 2: - data_source = "MSP430 EnergyTrace" + data_source = "MSP430 EnergyTrace, sync={}".format( + raw_data.ptalog["opt"]["energytrace"]["sync"] + ) print(f" Data source ID: {raw_data.version} ({data_source})") preprocessed_data = raw_data.get_preprocessed_data() -- cgit v1.2.3 From 67f44728a1dd9a3c786bd5602bd1ac0834ebd8ea Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 8 Jul 2020 15:09:55 +0200 Subject: RawData: load ptalog if available --- bin/analyze-archive.py | 9 ++++++--- lib/loader.py | 13 +++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index 74a2d41..5c7c97e 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -377,9 +377,12 @@ if __name__ == "__main__": if raw_data.version <= 1: data_source = "MIMOSA" elif raw_data.version == 2: - data_source = "MSP430 EnergyTrace, sync={}".format( - raw_data.ptalog["opt"]["energytrace"]["sync"] - ) + if raw_data.ptalog and "sync" in raw_data.ptalog["opt"]["energytrace"]: + data_source = "MSP430 EnergyTrace, sync={}".format( + raw_data.ptalog["opt"]["energytrace"]["sync"] + ) + else: + data_source = "MSP430 EnergyTrace" print(f" Data source ID: {raw_data.version} ({data_source})") preprocessed_data = raw_data.get_preprocessed_data() diff --git a/lib/loader.py b/lib/loader.py index 77b8652..c35eb4c 100644 --- a/lib/loader.py +++ b/lib/loader.py @@ -305,6 +305,7 @@ class RawData: self._parameter_names = None self.ignore_clipping = False self.pta = None + self.ptalog = None with tarfile.open(filenames[0]) as tf: for member in tf.getmembers(): @@ -315,6 +316,9 @@ class RawData: elif ".etlog" in member.name: self.version = 2 break + if self.version >= 1: + self.ptalog = json.load(tf.extractfile(tf.getmember("ptalog.json"))) + self.pta = self.ptalog["pta"] self.set_cache_file() if not with_traces: @@ -334,6 +338,8 @@ class RawData: self.preprocessing_stats = cache_data["preprocessing_stats"] if "pta" in cache_data: self.pta = cache_data["pta"] + if "ptalog" in cache_data: + self.ptalog = cache_data["ptalog"] self.setup_by_fileno = cache_data["setup_by_fileno"] self.preprocessed = True @@ -350,6 +356,7 @@ class RawData: "traces": self.traces, "preprocessing_stats": self.preprocessing_stats, "pta": self.pta, + "ptalog": self.ptalog, "setup_by_fileno": self.setup_by_fileno, } json.dump(cache_data, f) @@ -847,8 +854,7 @@ class RawData: new_filenames = list() with tarfile.open(filename) as tf: - ptalog = json.load(tf.extractfile(tf.getmember("ptalog.json"))) - self.pta = ptalog["pta"] + ptalog = self.ptalog # Benchmark code may be too large to be executed in a single # run, so benchmarks (a benchmark is basically a list of DFA runs) @@ -902,8 +908,7 @@ class RawData: new_filenames = list() with tarfile.open(filename) as tf: - ptalog = json.load(tf.extractfile(tf.getmember("ptalog.json"))) - self.pta = ptalog["pta"] + ptalog = self.ptalog # Benchmark code may be too large to be executed in a single # run, so benchmarks (a benchmark is basically a list of DFA runs) -- cgit v1.2.3