summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-07-25 15:34:25 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-07-25 15:34:25 +0200
commit5d1ddebcfdc372902d6b01f267b622094c2c751c (patch)
tree3e5ad07e9546888ce2d6f558ce9e5f513bbb519f /bin
parente0609155a809167cb260a441f708362a189852ab (diff)
Move trace filter from postprocessing to automata module
This drastically increases performance
Diffstat (limited to 'bin')
-rwxr-xr-xbin/generate-dfa-benchmark.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py
index 8e3c227..ac1bdd6 100755
--- a/bin/generate-dfa-benchmark.py
+++ b/bin/generate-dfa-benchmark.py
@@ -37,16 +37,7 @@ import yaml
from automata import PTA
from harness import OnboardTimerHarness
-opt = {}
-
-def trace_matches_filter(trace: list, trace_filter: list) -> bool:
- for allowed_trace in trace_filter:
- if len(trace) < len(allowed_trace):
- continue
- different_element_count = len(list(filter(None, map(lambda x,y: x[0].name != y, trace, allowed_trace))))
- if different_element_count == 0:
- return True
- return False
+opt = dict()
def benchmark_from_runs(pta: PTA, runs: list, harness: object, benchmark_id: int = 0) -> io.StringIO:
outbuf = io.StringIO()
@@ -215,6 +206,8 @@ if __name__ == '__main__':
for trace in opt['trace-filter'].split():
trace_filter.append(trace.split(','))
opt['trace-filter'] = trace_filter
+ else:
+ opt['trace-filter'] = None
except getopt.GetoptError as err:
print(err)
@@ -233,12 +226,7 @@ if __name__ == '__main__':
else:
timer_pin = 'GPIO::p1_0'
- runs = list()
-
- for run in pta.dfs(opt['depth'], with_arguments = True, with_parameters = True):
- if 'trace-filter' in opt and not trace_matches_filter(run, opt['trace-filter']):
- continue
- runs.append(run)
+ runs = list(pta.dfs(opt['depth'], with_arguments = True, with_parameters = True, trace_filter = opt['trace-filter']))
num_transitions = len(runs)