summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-11-25 15:15:07 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-11-25 15:15:07 +0100
commit40071a6e1ad9b53608f2d010fc7a62786895b05d (patch)
treec10f366bf1099ab2adea0bab78f814e4f7f52487 /bin
parent1cea59bcc6235dbaa83069f454107664a06f2ab3 (diff)
add accounting overhead evaluation helper
Diffstat (limited to 'bin')
-rwxr-xr-xbin/eval-accounting-overhead.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/eval-accounting-overhead.py b/bin/eval-accounting-overhead.py
new file mode 100755
index 0000000..9f1e98c
--- /dev/null
+++ b/bin/eval-accounting-overhead.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+"""
+eval-accounting-overhead -- evaluate overhead of various accounting methods and energy/power/timestamp integer sizes
+
+Usage:
+PYTHONPATH=lib bin/eval-accounting-overhead.py <files ...>
+
+Data Generation:
+for accounting in static_state_immediate 'static_state' 'static_statetransition_immediate' 'static_statetransition'; do for intsize in uint16_t uint32_t uint64_t; do PYTHONPATH=~/var/ess/aemr/dfatool/lib ~/var/ess/aemr/dfatool/bin/generate-dfa-benchmark.py --timer-pin=GPIO::p1_0 --sleep=30 --repeat=10 --depth=10 --arch=msp430fr5994lp --app=test_benchmark --trace-filter='setup,setAutoAck,write,getEnergy,$' --timing --dummy= --accounting=${accounting},ts_type=${intsize},power_type=${intsize},energy_type=${intsize} model/driver/nrf24l01.dfa ~/var/projects/multipass/src/app/test_benchmark/main.cc; done; done
+
+Feed the resulting files into this script, output is one line per file
+providing overhead per transition and getEnergy overhead
+
+"""
+
+from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate
+import json
+import sys
+
+for filename in sys.argv[1:]:
+ with open(filename, 'r') as f:
+ measurement = json.load(f)
+ raw_data = TimingData([filename])
+ preprocessed_data = raw_data.get_preprocessed_data()
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = AnalyticModel(by_name, parameters, arg_count)
+ static_model = model.get_static()
+ if 'setup' in model.names:
+ transition_duration = static_model('setup', 'duration')
+ elif 'init' in model.names:
+ transition_duration = static_model('init', 'duration')
+ get_energy_duration = static_model('getEnergy', 'duration')
+
+ print('{:60s}: {:.0f} / {:.0f} µs'.format(measurement['opt']['accounting'], transition_duration, get_energy_duration))