From 813bbdec263fde4fdf651c0b848d73e4d4063217 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 8 Jul 2020 12:24:22 +0200 Subject: Fix incomplete raw_output in generate-dfa-benchmark output --- bin/analyze-archive.py | 4 ++-- lib/harness.py | 2 +- lib/runner.py | 16 +++++++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index 175570b..908915c 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -623,8 +623,8 @@ if __name__ == "__main__": if "param" in show_models or "all" in show_models: if not model.stats.can_be_fitted(): - print( - "[!] measurements have insufficient distinct numeric parameters for fitting. A parameter-aware model is not available." + logging.warning( + "measurements have insufficient distinct numeric parameters for fitting. A parameter-aware model is not available." ) for state in model.states(): for attribute in model.attributes(state): diff --git a/lib/harness.py b/lib/harness.py index 3b279c0..1c3dbe0 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -21,7 +21,7 @@ class TransitionHarness: * `name`: state or transition name * `parameter`: currently valid parameter values. If normalization is used, they are already normalized. Each parameter value is either a primitive int/float/str value (-> constant for each iteration) or a list of - primitive values (-> set by the return value of the current run, not necessarily constan) + primitive values (-> set by the return value of the current run, not necessarily constant) * `args`: function arguments, if isa == 'transition' """ diff --git a/lib/runner.py b/lib/runner.py index 16f0a29..0a32091 100644 --- a/lib/runner.py +++ b/lib/runner.py @@ -31,7 +31,8 @@ class SerialReader(serial.threaded.Protocol): """Create a new SerialReader object.""" self.callback = callback self.recv_buf = "" - self.lines = [] + self.lines = list() + self.all_lines = list() def __call__(self): return self @@ -47,7 +48,9 @@ class SerialReader(serial.threaded.Protocol): # Note: Do not call str.strip on lines[-1]! Otherwise, lines may be mangled lines = self.recv_buf.split("\n") if len(lines) > 1: - self.lines.extend(map(str.strip, lines[:-1])) + new_lines = list(map(str.strip, lines[:-1])) + self.lines.extend(new_lines) + self.all_lines.extend(new_lines) self.recv_buf = lines[-1] if self.callback: for line in lines[:-1]: @@ -120,7 +123,7 @@ class SerialMonitor: return self.reader.get_lines() def get_lines(self) -> list: - return self.reader.get_lines() + return self.reader.all_lines def get_files(self) -> list: return list() @@ -143,6 +146,9 @@ class SerialMonitor: class EnergyTraceMonitor(SerialMonitor): """EnergyTraceMonitor captures serial timing output and EnergyTrace energy data.""" + # Zusätzliche key-value-Argumente von generate-dfa-benchmark.py --energytrace=... landen hier + # (z.B. --energytrace=var1=bar,somecount=2 => EnerygTraceMonitor(..., var1="bar", somecount="2")). + # Soald das EnergyTraceMonitor-Objekt erzeugt wird, beginnt die Messung (d.h. hier: msp430-etv wird gestartet) def __init__(self, port: str, baud: int, callback=None, voltage=3.3): super().__init__(port=port, baud=baud, callback=callback) self._voltage = voltage @@ -155,14 +161,18 @@ class EnergyTraceMonitor(SerialMonitor): cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True ) + # Benchmark fertig -> externe Hilfsprogramme beenden def close(self): super().close() self._logger.send_signal(subprocess.signal.SIGINT) stdout, stderr = self._logger.communicate(timeout=15) + # Zusätzliche Dateien, die mit dem Benchmark-Log und -Plan abgespeichert werden sollen + # (hier: Die von msp430-etv generierten Logfiles) def get_files(self) -> list: return [self._output] + # def get_config(self) -> dict: return { "voltage": self._voltage, -- cgit v1.2.3