summaryrefslogtreecommitdiff
path: root/bin/generate-dfa-benchmark.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-10-30 15:49:54 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-10-30 15:49:54 +0100
commit6a3a5ccd3d3da7f9171b96bcf9be7aaef10a4a7a (patch)
treeec337421ba3c7923ca170475ae76bc618eb19583 /bin/generate-dfa-benchmark.py
parentf433a9fa3a464d611e75b26fcb540dd835f693d7 (diff)
Allow taking DFA/PTA measurements with EnergyTrace hardware
Diffstat (limited to 'bin/generate-dfa-benchmark.py')
-rwxr-xr-xbin/generate-dfa-benchmark.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py
index e157f1f..5d89a2d 100755
--- a/bin/generate-dfa-benchmark.py
+++ b/bin/generate-dfa-benchmark.py
@@ -29,7 +29,7 @@ Options:
Override the name of the class instance used for benchmarking
--mimosa=[k=v,k=v,...]
- Perform energy measurements with MIMOSA. Takes precedence over --timing.
+ Perform energy measurements with MIMOSA. Takes precedence over --timing and --energytrace.
mimosa options are key-value pairs. Possible settings with defaults:
offset = 130 (mysterious 0V offset)
shunt = 330 (measurement shunt in ohms)
@@ -46,6 +46,9 @@ Options:
Perform timing measurements using on-chip counters (no external hardware
required)
+--energytrace
+ Perform energy measurements using MSP430 EnergyTrace hardware. Includes --timing.
+
--trace-filter=<transition,transition,transition,...>[ <transition,transition,transition,...> ...]
Only consider traces whose beginning matches one of the provided transition sequences.
E.g. --trace-filter='init,foo init,bar' will only consider traces with init as first and foo or bar as second transition,
@@ -161,7 +164,7 @@ def benchmark_from_runs(pta: PTA, runs: list, harness: OnboardTimerHarness, benc
return outbuf
def run_benchmark(application_file: str, pta: PTA, runs: list, arch: str, app: str, run_args: list, harness: object, sleep: int = 0, repeat: int = 0, run_offset: int = 0, runs_total: int = 0, dummy = False):
- if 'mimosa' in opt:
+ if 'mimosa' in opt or 'energytrace' in opt:
outbuf = benchmark_from_runs(pta, runs, harness, dummy = dummy, repeat = 1)
else:
outbuf = benchmark_from_runs(pta, runs, harness, dummy = dummy, repeat = repeat)
@@ -201,12 +204,15 @@ def run_benchmark(application_file: str, pta: PTA, runs: list, arch: str, app: s
return results
- if 'mimosa' in opt:
+ if 'mimosa' in opt or 'energytrace' in opt:
files = list()
i = 0
while i < opt['repeat']:
runner.flash(arch, app, run_args)
- monitor = runner.get_monitor(arch, callback = harness.parser_cb, mimosa = opt['mimosa'])
+ if 'mimosa' in opt:
+ monitor = runner.get_monitor(arch, callback = harness.parser_cb, mimosa = opt['mimosa'])
+ elif 'energytrace' in opt:
+ monitor = runner.get_monitor(arch, callback = harness.parser_cb, energytrace = opt['energytrace'])
sync_error = False
try:
@@ -268,6 +274,7 @@ if __name__ == '__main__':
'app= '
'depth= '
'dummy= '
+ 'energytrace= '
'instance= '
'mimosa= '
'repeat= '
@@ -316,6 +323,15 @@ if __name__ == '__main__':
if opt['repeat'] == 0:
opt['repeat'] = 1
+ if 'energytrace' in opt:
+ if opt['energytrace'] == '':
+ opt['energytrace'] = dict()
+ else:
+ opt['energytrace'] = dict(map(lambda x: x.split('='), opt['energytrace'].split(',')))
+ opt.pop('timing', None)
+ if opt['repeat'] == 0:
+ opt['repeat'] = 1
+
except getopt.GetoptError as err:
print(err)
sys.exit(2)
@@ -369,6 +385,8 @@ if __name__ == '__main__':
if 'mimosa' in opt:
harness = TransitionHarness(gpio_pin = timer_pin, pta = pta, log_return_values = need_return_values, repeat = 1, post_transition_delay_us = 20)
+ elif 'energytrace' in opt:
+ harness = OnboardTimerHarness(gpio_pin = timer_pin, pta = pta, counter_limits = runner.get_counter_limits_us(opt['arch']), log_return_values = need_return_values, repeat = 1)
elif 'timing' in opt:
harness = OnboardTimerHarness(gpio_pin = timer_pin, pta = pta, counter_limits = runner.get_counter_limits_us(opt['arch']), log_return_values = need_return_values, repeat = opt['repeat'])