1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-26 06:48:53 +00:00

wa/instruments: pylint/fixes

This commit is contained in:
Marc Bonnici 2018-07-03 14:25:33 +01:00
parent 0b8501e010
commit 6afd710bd1
7 changed files with 18 additions and 20 deletions

View File

@ -38,7 +38,7 @@ class DmesgInstrument(Instrument):
loglevel_file = '/proc/sys/kernel/printk' loglevel_file = '/proc/sys/kernel/printk'
def initialize(self, context): def initialize(self, context): #pylint: disable=unused-argument
self.need_root = self.target.os == 'android' self.need_root = self.target.os == 'android'
if self.need_root and not self.target.is_rooted: if self.need_root and not self.target.is_rooted:
raise InstrumentError('Need root to collect dmesg on Android') raise InstrumentError('Need root to collect dmesg on Android')

View File

@ -20,7 +20,6 @@ from collections import defaultdict
import os import os
import shutil import shutil
from wa.utils.types import list_of_numbers
from devlib import DerivedEnergyMeasurements from devlib import DerivedEnergyMeasurements
from devlib.instrument import CONTINUOUS from devlib.instrument import CONTINUOUS
@ -36,7 +35,8 @@ from wa import Instrument, Parameter
from wa.framework import pluginloader from wa.framework import pluginloader
from wa.framework.plugin import Plugin from wa.framework.plugin import Plugin
from wa.framework.exception import ConfigError, InstrumentError from wa.framework.exception import ConfigError, InstrumentError
from wa.utils.types import list_of_strings, list_of_ints, list_or_string, obj_dict, identifier from wa.utils.types import (list_of_strings, list_of_ints, list_or_string,
obj_dict, identifier, list_of_numbers)
class EnergyInstrumentBackend(Plugin): class EnergyInstrumentBackend(Plugin):
@ -60,7 +60,7 @@ class EnergyInstrumentBackend(Plugin):
Typically there is just a single device/instrument, in which case the Typically there is just a single device/instrument, in which case the
device key is arbitrary. device key is arbitrary.
""" """
return {None: self.instrument(target, **kwargs)} return {None: self.instrument(target, **kwargs)} #pylint: disable=not-callable
class DAQBackend(EnergyInstrumentBackend): class DAQBackend(EnergyInstrumentBackend):
@ -284,6 +284,7 @@ class AcmeCapeBackend(EnergyInstrumentBackend):
"""), """),
] ]
#pylint: disable=arguments-differ
def get_instruments(self, target, metadir, def get_instruments(self, target, metadir,
iio_capture, host, iio_devices, buffer_size): iio_capture, host, iio_devices, buffer_size):
@ -428,7 +429,7 @@ class EnergyMeasurement(Instrument):
self.instruments = self.backend.get_instruments(self.target, context.run_output.metadir, **self.params) self.instruments = self.backend.get_instruments(self.target, context.run_output.metadir, **self.params)
for instrument in self.instruments.values(): for instrument in self.instruments.values():
if not (instrument.mode & CONTINUOUS): if not (instrument.mode & CONTINUOUS): #pylint: disable=superfluous-parens
msg = '{} instrument does not support continuous measurement collection' msg = '{} instrument does not support continuous measurement collection'
raise ConfigError(msg.format(self.instrument)) raise ConfigError(msg.format(self.instrument))
instrument.setup() instrument.setup()
@ -506,4 +507,3 @@ class EnergyMeasurement(Instrument):
units = metrics[0].units units = metrics[0].units
value = sum(m.value for m in metrics) value = sum(m.value for m in metrics)
context.add_metric(name, value, units) context.add_metric(name, value, units)

View File

@ -119,6 +119,7 @@ class FpsInstrument(Instrument):
return return
self._is_enabled = True self._is_enabled = True
#pylint: disable=redefined-variable-type
if use_gfxinfo: if use_gfxinfo:
self.collector = GfxInfoFramesInstrument(self.target, collector_target, self.period) self.collector = GfxInfoFramesInstrument(self.target, collector_target, self.period)
self.processor = DerivedGfxInfoStats(self.drop_threshold, filename='fps.csv') self.processor = DerivedGfxInfoStats(self.drop_threshold, filename='fps.csv')
@ -127,12 +128,12 @@ class FpsInstrument(Instrument):
self.processor = DerivedSurfaceFlingerStats(self.drop_threshold, filename='fps.csv') self.processor = DerivedSurfaceFlingerStats(self.drop_threshold, filename='fps.csv')
self.collector.reset() self.collector.reset()
def start(self, context): def start(self, context): #pylint: disable=unused-argument
if not self._is_enabled: if not self._is_enabled:
return return
self.collector.start() self.collector.start()
def stop(self, context): def stop(self, context): #pylint: disable=unused-argument
if not self._is_enabled: if not self._is_enabled:
return return
self.collector.stop() self.collector.stop()

View File

@ -41,18 +41,18 @@ class HwmonInstrument(Instrument):
hwmon data will be reported. hwmon data will be reported.
""" """
def initialize(self, context): def initialize(self, context): #pylint: disable=unused-argument
self.instrument = _Instrument(self.target) self.instrument = _Instrument(self.target)
def setup(self, context): def setup(self, context): #pylint: disable=unused-argument
self.instrument.reset() self.instrument.reset()
@fast @fast
def start(self, context): def start(self, context): #pylint: disable=unused-argument
self.before = self.instrument.take_measurement() self.before = self.instrument.take_measurement()
@fast @fast
def stop(self, context): def stop(self, context): #pylint: disable=unused-argument
self.after = self.instrument.take_measurement() self.after = self.instrument.take_measurement()
def update_output(self, context): def update_output(self, context):
@ -85,5 +85,5 @@ class HwmonInstrument(Instrument):
"Don't know what to do with hwmon channel '{}'" "Don't know what to do with hwmon channel '{}'"
.format(measurement_after.channel)) .format(measurement_after.channel))
def teardown(self, context): def teardown(self, context): #pylint: disable=unused-argument
self.instrument.teardown() self.instrument.teardown()

View File

@ -26,14 +26,11 @@ Some "standard" instruments to collect additional info about workload execution.
precise data about specific operations. precise data about specific operations.
""" """
import os import os
import re
import logging import logging
import time import time
import tarfile import tarfile
from subprocess import CalledProcessError from subprocess import CalledProcessError
from future.moves.itertools import zip_longest
from devlib.exception import TargetError from devlib.exception import TargetError
from devlib.utils.android import ApkInfo from devlib.utils.android import ApkInfo
@ -41,7 +38,7 @@ from wa import Instrument, Parameter, very_fast
from wa.framework.exception import ConfigError from wa.framework.exception import ConfigError
from wa.framework.instrument import slow from wa.framework.instrument import slow
from wa.utils.diff import diff_sysfs_dirs, diff_interrupt_files from wa.utils.diff import diff_sysfs_dirs, diff_interrupt_files
from wa.utils.misc import as_relative, diff_tokens, write_table from wa.utils.misc import as_relative
from wa.utils.misc import ensure_file_directory_exists as _f from wa.utils.misc import ensure_file_directory_exists as _f
from wa.utils.misc import ensure_directory_exists as _d from wa.utils.misc import ensure_directory_exists as _d
from wa.utils.types import list_of_strings from wa.utils.types import list_of_strings

View File

@ -50,8 +50,8 @@ class ScreenCaptureInstrument(Instrument):
output_path, output_path,
self.period) self.period)
def start(self, context): def start(self, context): #pylint: disable=unused-argument
self.collector.start() self.collector.start()
def stop(self, context): def stop(self, context): #pylint: disable=unused-argument
self.collector.stop() self.collector.stop()

View File

@ -17,7 +17,7 @@ import os
from devlib import SerialTraceCollector from devlib import SerialTraceCollector
from wa import Instrument, Parameter, InstrumentError, hostside from wa import Instrument, Parameter, hostside
class SerialMon(Instrument): class SerialMon(Instrument):