1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 02:41:11 +01:00

hwmon: move sensor discovery into initialize()

It only needs to be done once per run.
This commit is contained in:
Sergei Trofimov 2015-05-07 09:39:33 +01:00
parent f504fc8791
commit 7a86a1b17f

View File

@ -82,13 +82,15 @@ class HwmonInstrument(Instrument):
self.sensors = []
def setup(self, context):
def initialize(self, context):
self.sensors = []
self.logger.debug('Searching for HWMON sensors.')
discovered_sensors = discover_sensors(self.device, self.sensor_kinds.keys())
for sensor in sorted(discovered_sensors, key=lambda s: HWMON_SENSOR_PRIORITIES.index(s.kind)):
self.logger.debug('Adding {}'.format(sensor.filepath))
self.sensors.append(sensor)
def setup(self, context):
for sensor in self.sensors:
sensor.clear_readings()