summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-11-16 14:36:50 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2020-11-16 14:36:50 +0100
commit89d564fa6a6ed7f97d8b0f0201b1424340f21c27 (patch)
treec810152678a0100c89edbab5d44e55b0e051984a
parentc16163f5bcea9df186c04c9820abe1d3f509b023 (diff)
do not parse energytrace logs with large sync offset
-rw-r--r--lib/lennart/DataProcessor.py2
-rw-r--r--lib/loader.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py
index 8341b9c..1e30f36 100644
--- a/lib/lennart/DataProcessor.py
+++ b/lib/lennart/DataProcessor.py
@@ -112,7 +112,7 @@ class DataProcessor:
logger.debug(f"Start/End offsets: {start_offset} / {end_offset}")
if abs(end_offset) > 10:
- logger.warning(
+ raise RuntimeError(
f"synchronization end_offset == {end_offset}. It should be no more than a few seconds."
)
diff --git a/lib/loader.py b/lib/loader.py
index 4cb5dc0..e5e8746 100644
--- a/lib/loader.py
+++ b/lib/loader.py
@@ -121,6 +121,7 @@ def _preprocess_etlog(measurement):
measurement["transition_names"],
with_traces=measurement["with_traces"],
)
+ states_and_transitions = list()
try:
etlog.load_data(measurement["content"])
states_and_transitions = etlog.analyze_states(
@@ -128,6 +129,8 @@ def _preprocess_etlog(measurement):
)
except EOFError as e:
etlog.errors.append("EnergyTrace logfile error: {}".format(e))
+ except RuntimeError as e:
+ etlog.errors.append("EnergyTrace loader error: {}".format(e))
processed_data = {
"fileno": measurement["fileno"],
@@ -1738,10 +1741,11 @@ class EnergyTraceWithLogicAnalyzer:
state_sleep=self.state_duration, with_traces=self.with_traces
)
# Uncomment to plot traces
- if offline_index == 0 and os.getenv("DFATOOL_PLOT_LASYNC") is not None:
+ if os.getenv("DFATOOL_PLOT_LASYNC") is not None and offline_index == int(
+ os.getenv("DFATOOL_PLOT_LASYNC")
+ ):
dp.plot() # <- plot traces with sync annotatons
# dp.plot(names) # <- plot annotated traces (with state/transition names)
- pass
if os.getenv("DFATOOL_EXPORT_LASYNC") is not None:
filename = os.getenv("DFATOOL_EXPORT_LASYNC") + f"_{offline_index}.json"
with open(filename, "w") as f: