aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2018-03-16 17:27:20 +0100
committerMarc Bonnici <marc.bonnici@arm.com>2018-03-28 09:29:08 +0100
commitec316eab03d9d0a5541bd613ea663e3056e71d12 (patch)
tree67fbcf245d0cb0e1b76f96a69af33ee55c501e4b
parent3c1369c2689cdd765d3efac8629cdb3a54584fc4 (diff)
Add arm energy probe instrument
Arm Energy Probe with arm_probe has been recently added in devlib's instrument. Add the arm_energy_probe in the WA list of Energy measurement instruments Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
-rw-r--r--wa/instruments/energy_measurement.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/wa/instruments/energy_measurement.py b/wa/instruments/energy_measurement.py
index f171f7c0..5434b0b0 100644
--- a/wa/instruments/energy_measurement.py
+++ b/wa/instruments/energy_measurement.py
@@ -18,10 +18,12 @@
from __future__ import division
from collections import defaultdict
import os
+import shutil
from devlib import DerivedEnergyMeasurements
from devlib.instrument import CONTINUOUS
from devlib.instrument.energy_probe import EnergyProbeInstrument
+from devlib.instrument.arm_energy_probe import ArmEnergyProbeInstrument
from devlib.instrument.daq import DaqInstrument
from devlib.instrument.acmecape import AcmeCapeInstrument
from devlib.instrument.monsoon import MonsoonInstrument
@@ -162,6 +164,37 @@ class EnergyProbeBackend(EnergyInstrumentBackend):
msg = 'Number of Energy Probe port labels does not match the number of resistor values.'
raise ConfigError(msg)
+class ArmEnergyProbeBackend(EnergyInstrumentBackend):
+
+ name = 'arm_energy_probe'
+
+ parameters = [
+ Parameter('config_file', kind=str,
+ description="""
+ Path to config file of the AEP
+ """),
+ ]
+
+ instrument = ArmEnergyProbeInstrument
+
+ def get_instruments(self, target, metadir, **kwargs):
+ """
+ Get a dict mapping device keys to an Instruments
+
+ Typically there is just a single device/instrument, in which case the
+ device key is arbitrary.
+ """
+
+ shutil.copy(self.config_file, metadirr)
+
+ return {None: self.instrument(target, **kwargs)}
+
+ def validate_parameters(self, params):
+ if not params.get('config_file'):
+ raise ConfigError('Mandatory parameter "config_file" is not set.')
+ self.config_file = params.get('config_file')
+ if not os.path.exists(self.config_file):
+ raise ConfigError('"config_file" does not exist.')
class AcmeCapeBackend(EnergyInstrumentBackend):
@@ -249,7 +282,7 @@ class EnergyMeasurement(Instrument):
parameters = [
Parameter('instrument', kind=str, mandatory=True,
- allowed_values=['daq', 'energy_probe', 'acme_cape', 'monsoon', 'juno_readenergy'],
+ allowed_values=['daq', 'energy_probe', 'acme_cape', 'monsoon', 'juno_readenergy', 'arm_energy_probe'],
description="""
Specify the energy instruments to be enabled.
"""),