summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cycles_to_energy.py6
-rw-r--r--lib/data_parameters.py12
2 files changed, 12 insertions, 6 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 = {
diff --git a/lib/data_parameters.py b/lib/data_parameters.py
index ef463bc..e7a14b0 100644
--- a/lib/data_parameters.py
+++ b/lib/data_parameters.py
@@ -280,27 +280,27 @@ class Protolog:
for arch in self.aggregate[key].keys():
for lib, val in self.aggregate[key][arch].items():
try:
- val['energy_enc'] = int(val['cycles_enc'] * cpu.get_current(cpu_conf) * cpu_conf['voltage'] / cpu_conf['cpu_freq'] * 1e9)
+ val['energy_enc'] = int(val['cycles_enc'] * cpu.get_power(cpu_conf) / cpu_conf['cpu_freq'] * 1e9)
except KeyError:
pass
try:
- val['energy_ser'] = int(val['cycles_ser'] * cpu.get_current(cpu_conf) * cpu_conf['voltage'] / cpu_conf['cpu_freq'] * 1e9)
+ val['energy_ser'] = int(val['cycles_ser'] * cpu.get_power(cpu_conf) / cpu_conf['cpu_freq'] * 1e9)
except KeyError:
pass
try:
- val['energy_encser'] = int(val['cycles_encser'] * cpu.get_current(cpu_conf) * cpu_conf['voltage'] / cpu_conf['cpu_freq'] * 1e9)
+ val['energy_encser'] = int(val['cycles_encser'] * cpu.get_power(cpu_conf) / cpu_conf['cpu_freq'] * 1e9)
except KeyError:
pass
try:
- val['energy_des'] = int(val['cycles_des'] * cpu.get_current(cpu_conf) * cpu_conf['voltage'] / cpu_conf['cpu_freq'] * 1e9)
+ val['energy_des'] = int(val['cycles_des'] * cpu.get_power(cpu_conf) / cpu_conf['cpu_freq'] * 1e9)
except KeyError:
pass
try:
- val['energy_dec'] = int(val['cycles_dec'] * cpu.get_current(cpu_conf) * cpu_conf['voltage'] / cpu_conf['cpu_freq'] * 1e9)
+ val['energy_dec'] = int(val['cycles_dec'] * cpu.get_power(cpu_conf) / cpu_conf['cpu_freq'] * 1e9)
except KeyError:
pass
try:
- val['energy_desdec'] = int(val['cycles_desdec'] * cpu.get_current(cpu_conf) * cpu_conf['voltage'] / cpu_conf['cpu_freq'] * 1e9)
+ val['energy_desdec'] = int(val['cycles_desdec'] * cpu.get_power(cpu_conf) / cpu_conf['cpu_freq'] * 1e9)
except KeyError:
pass