summaryrefslogtreecommitdiff
path: root/lib/cycles_to_energy.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-05-09 08:07:20 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-05-09 08:07:20 +0200
commitb64016d8bb36afa750edf1637360001a84a2d309 (patch)
tree1a9382529128b458270667b6dbc410008860d8a9 /lib/cycles_to_energy.py
parent8e547294b0fd4c8041f4ee61f0a01b3a84b9a97d (diff)
cycles_to_energy: Add get_power function
Diffstat (limited to 'lib/cycles_to_energy.py')
-rw-r--r--lib/cycles_to_energy.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/cycles_to_energy.py b/lib/cycles_to_energy.py
index bfbac75..53b1e46 100644
--- a/lib/cycles_to_energy.py
+++ b/lib/cycles_to_energy.py
@@ -50,6 +50,12 @@ class MSP430:
return MSP430.current_by_mem[params['memory']][cpu_freq_index] * 1e-6
+ def get_power(params):
+ if type(params) != dict:
+ return MSP430.get_energy(_param_list_to_dict(MSP430, params))
+
+ return MSP430.get_current(params) * params['voltage']
+
class ATMega168:
name = 'ATMega168'
parameters = {