From 446a1cfbb061e3278915827425aa80beaccbb193 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 10 Jan 2018 14:54:43 +0000 Subject: [PATCH] wa: Rename `Instrumentation` to `Instruments` To be maintain a consistent naming scheme, rename all instances of `Instrumentation` to `Instruments` --- wa/__init__.py | 2 +- wa/commands/create.py | 4 ++-- wa/commands/run.py | 2 +- wa/framework/agenda.py | 6 +++--- wa/framework/configuration/core.py | 2 +- wa/framework/configuration/default.py | 2 +- wa/framework/configuration/parsers.py | 8 ++++---- wa/framework/execution.py | 8 ++++---- wa/framework/{instrumentation.py => instruments.py} | 10 +++++----- wa/framework/output_processor.py | 2 +- wa/framework/signal.py | 8 ++++---- wa/{instrumentation => instruments}/__init__.py | 0 wa/{instrumentation => instruments}/dmesg.py | 2 +- .../energy_measurement.py | 6 +++--- wa/{instrumentation => instruments}/fps.py | 0 wa/{instrumentation => instruments}/hwmon.py | 2 +- wa/{instrumentation => instruments}/misc.py | 2 +- wa/{instrumentation => instruments}/poller/Makefile | 0 .../poller/__init__.py | 0 .../poller/bin/arm64/poller | Bin .../poller/bin/armeabi/poller | Bin wa/{instrumentation => instruments}/poller/poller.c | 0 wa/{instrumentation => instruments}/trace-cmd.py | 2 +- 23 files changed, 34 insertions(+), 34 deletions(-) rename wa/framework/{instrumentation.py => instruments.py} (98%) rename wa/{instrumentation => instruments}/__init__.py (100%) rename wa/{instrumentation => instruments}/dmesg.py (98%) rename wa/{instrumentation => instruments}/energy_measurement.py (99%) rename wa/{instrumentation => instruments}/fps.py (100%) rename wa/{instrumentation => instruments}/hwmon.py (98%) rename wa/{instrumentation => instruments}/misc.py (99%) rename wa/{instrumentation => instruments}/poller/Makefile (100%) rename wa/{instrumentation => instruments}/poller/__init__.py (100%) rename wa/{instrumentation => instruments}/poller/bin/arm64/poller (100%) rename wa/{instrumentation => instruments}/poller/bin/armeabi/poller (100%) rename wa/{instrumentation => instruments}/poller/poller.c (100%) rename wa/{instrumentation => instruments}/trace-cmd.py (99%) diff --git a/wa/__init__.py b/wa/__init__.py index 900fa0f0..5c13f199 100644 --- a/wa/__init__.py +++ b/wa/__init__.py @@ -8,7 +8,7 @@ from wa.framework.exception import (OutputProcessorError, ResourceError, from wa.framework.exception import (WAError, NotFoundError, ValidationError, WorkloadError) from wa.framework.exception import WorkerThreadError, PluginLoaderError -from wa.framework.instrumentation import (Instrument, very_slow, slow, normal, fast, +from wa.framework.instruments import (Instrument, very_slow, slow, normal, fast, very_fast) from wa.framework.output import RunOutput, discover_wa_outputs from wa.framework.plugin import Plugin, Parameter diff --git a/wa/commands/create.py b/wa/commands/create.py index 4e9a5e78..56b8f41b 100644 --- a/wa/commands/create.py +++ b/wa/commands/create.py @@ -36,7 +36,7 @@ class CreateAgendaSubcommand(SubCommand): def execute(self, state, args): agenda = OrderedDict() - agenda['config'] = OrderedDict(instrumentation=[], output_processors=[]) + agenda['config'] = OrderedDict(instruments=[], output_processors=[]) agenda['global'] = OrderedDict(iterations=args.iterations) agenda['workloads'] = [] target_desc = None @@ -64,7 +64,7 @@ class CreateAgendaSubcommand(SubCommand): agenda['workloads'].append(entry) else: if extcls.kind == 'instrument': - agenda['config']['instrumentation'].append(name) + agenda['config']['instruments'].append(name) if extcls.kind == 'output_processor': agenda['config']['output_processors'].append(name) agenda['config'][name] = config diff --git a/wa/commands/run.py b/wa/commands/run.py index 1334df3a..dd4fb430 100644 --- a/wa/commands/run.py +++ b/wa/commands/run.py @@ -76,7 +76,7 @@ class RunCommand(Command): metavar='INSTRUMENT', help=""" Specify an instrument or output processor to disable from the command line. This equivalent - to adding "~{metavar}" to the instrumentation + to adding "~{metavar}" to the instruments list in the agenda. This can be used to temporarily disable a troublesome instrument for a particular run without introducing diff --git a/wa/framework/agenda.py b/wa/framework/agenda.py index b4983fdd..a260047c 100644 --- a/wa/framework/agenda.py +++ b/wa/framework/agenda.py @@ -76,7 +76,7 @@ class AgendaWorkloadEntry(AgendaEntry): self.workload_parameters = get_aliased_param(kwargs, ['workload_parameters', 'workload_params', 'params'], default=OrderedDict()) - self.instrumentation = kwargs.pop('instrumentation', []) + self.instruments = kwargs.pop('instruments', []) self.flash = kwargs.pop('flash', OrderedDict()) self.classifiers = kwargs.pop('classifiers', OrderedDict()) if kwargs: @@ -103,7 +103,7 @@ class AgendaSectionEntry(AgendaEntry): self.workload_parameters = get_aliased_param(kwargs, ['workload_parameters', 'workload_params'], default=OrderedDict()) - self.instrumentation = kwargs.pop('instrumentation', []) + self.instruments = kwargs.pop('instruments', []) self.flash = kwargs.pop('flash', OrderedDict()) self.classifiers = kwargs.pop('classifiers', OrderedDict()) self.workloads = [] @@ -136,7 +136,7 @@ class AgendaGlobalEntry(AgendaEntry): self.workload_parameters = get_aliased_param(kwargs, ['workload_parameters', 'workload_params'], default=OrderedDict()) - self.instrumentation = kwargs.pop('instrumentation', []) + self.instruments = kwargs.pop('instruments', []) self.flash = kwargs.pop('flash', OrderedDict()) self.classifiers = kwargs.pop('classifiers', OrderedDict()) if kwargs: diff --git a/wa/framework/configuration/core.py b/wa/framework/configuration/core.py index d8293f9a..35f9b3a6 100644 --- a/wa/framework/configuration/core.py +++ b/wa/framework/configuration/core.py @@ -557,7 +557,7 @@ class MetaConfiguration(Configuration): 'wa.commands', 'wa.framework.getters', 'wa.framework.target.descriptor', - 'wa.instrumentation', + 'wa.instruments', 'wa.output_processors', 'wa.workloads', ] diff --git a/wa/framework/configuration/default.py b/wa/framework/configuration/default.py index ddfec4af..8c2f980d 100644 --- a/wa/framework/configuration/default.py +++ b/wa/framework/configuration/default.py @@ -23,7 +23,7 @@ def _format_yaml_comment(param, short_description=False): def _format_instruments(output): plugin_cache = PluginCache() - output.write("instrumentation:\n") + output.write("instruments:\n") for plugin in DEFAULT_INSTRUMENTS: plugin_cls = plugin_cache.loader.get_plugin_class(plugin) output.writelines(_format_yaml_comment(plugin_cls, short_description=True)) diff --git a/wa/framework/configuration/parsers.py b/wa/framework/configuration/parsers.py index a5c5be69..2dfe26a6 100644 --- a/wa/framework/configuration/parsers.py +++ b/wa/framework/configuration/parsers.py @@ -208,10 +208,10 @@ def _load_file(filepath, error_name): def merge_augmentations(raw): """ - Since, from configuration perspective, output processors and instrumens are + Since, from configuration perspective, output processors and instruments are handled identically, the configuration entries are now interchangeable. E.g. it is - now valid to specify a output processor in instrumentation list. This is to make things - eassier for the users, as, from their perspective, the distinction is somewhat arbitrary. + now valid to specify a output processor in an instruments list. This is to make things + easier for the users, as, from their perspective, the distinction is somewhat arbitrary. For backwards compatibility, both entries are still valid, and this function merges them together into a single "augmentations" set, ensuring @@ -265,7 +265,7 @@ def _construct_valid_entry(raw, seen_ids, prefix, jobs_config): else: workload_entry['id'] = raw.pop('id') - # Process instrumentation + # Process instruments merge_augmentations(raw) # Validate all workload_entry diff --git a/wa/framework/execution.py b/wa/framework/execution.py index b121eda9..faad5a40 100644 --- a/wa/framework/execution.py +++ b/wa/framework/execution.py @@ -20,7 +20,7 @@ from copy import copy from datetime import datetime import wa.framework.signal as signal -from wa.framework import instrumentation +from wa.framework import instruments from wa.framework.configuration.core import Status from wa.framework.exception import HostError, WorkloadError from wa.framework.job import Job @@ -300,10 +300,10 @@ class Executor(object): output.write_job_specs(config_manager.job_specs) output.write_state() - self.logger.info('Installing instrumentation') + self.logger.info('Installing instruments') for instrument in config_manager.get_instruments(self.target_manager.target): - instrumentation.install(instrument, context) - instrumentation.validate() + instruments.install(instrument, context) + instruments.validate() self.logger.info('Installing output processors') pm = ProcessorManager() diff --git a/wa/framework/instrumentation.py b/wa/framework/instruments.py similarity index 98% rename from wa/framework/instrumentation.py rename to wa/framework/instruments.py index 5090cc59..1fc8a0e3 100644 --- a/wa/framework/instrumentation.py +++ b/wa/framework/instruments.py @@ -78,7 +78,7 @@ stop method:: The generated output can be updated inside update_output, or if it is trace, we just pull the file to the host device. context has an output variable which -has add_metric method. It can be used to add the instrumentation results metrics +has add_metric method. It can be used to add the instruments results metrics to the final result for the workload. The method can be passed 4 params, which are metric key, value, unit and lower_is_better, which is a boolean. :: @@ -90,7 +90,7 @@ are metric key, value, unit and lower_is_better, which is a boolean. :: # parse the file if needs to be parsed, or add result to # context.result -At the end, we might want to delete any files generated by the instrumentation +At the end, we might want to delete any files generated by the instruments and the code to clear these file goes in teardown method. :: def teardown(self, context): @@ -111,7 +111,7 @@ from wa.utils.misc import isiterable from wa.utils.types import identifier, enum, level -logger = logging.getLogger('instrumentation') +logger = logging.getLogger('instruments') # Maps method names onto signals the should be registered to. @@ -121,7 +121,7 @@ logger = logging.getLogger('instrumentation') # in the documentation SIGNAL_MAP = OrderedDict([ # Below are "aliases" for some of the more common signals to allow - # instrumentation to have similar structure to workloads + # instruments to have similar structure to workloads ('initialize', signal.RUN_INITIALIZED), ('setup', signal.BEFORE_WORKLOAD_SETUP), ('start', signal.BEFORE_WORKLOAD_EXECUTION), @@ -403,7 +403,7 @@ def get_disabled(): class Instrument(Plugin): """ - Base class for instrumentation implementations. + Base class for instrument implementations. """ kind = "instrument" diff --git a/wa/framework/output_processor.py b/wa/framework/output_processor.py index 3713efca..20fe7d82 100644 --- a/wa/framework/output_processor.py +++ b/wa/framework/output_processor.py @@ -2,7 +2,7 @@ import logging from wa.framework import pluginloader from wa.framework.exception import ConfigError -from wa.framework.instrumentation import is_installed +from wa.framework.instruments import is_installed from wa.framework.plugin import Plugin from wa.utils.log import log_error, indent, dedent diff --git a/wa/framework/signal.py b/wa/framework/signal.py index 9ac800cb..68c51d95 100644 --- a/wa/framework/signal.py +++ b/wa/framework/signal.py @@ -224,12 +224,12 @@ def connect(handler, signal, sender=dispatcher.Any, priority=0): :handler: This can be any callable that that takes the right arguments for the signal. For most signals this means a single argument that will be an ``ExecutionContext`` instance. But please see documentation - for individual signals in the :ref:`signals reference `. + for individual signals in the :ref:`signals reference `. :signal: The signal to which the handler will be subscribed. Please see - :ref:`signals reference ` for the list of standard WA + :ref:`signals reference ` for the list of standard WA signals. - .. note:: There is nothing that prevents instrumentation from sending their + .. note:: There is nothing that prevents instruments from sending their own signals that are not part of the standard set. However the signal must always be an :class:`wa.core.signal.Signal` instance. @@ -242,7 +242,7 @@ def connect(handler, signal, sender=dispatcher.Any, priority=0): Defaults to 0. .. note:: Priorities for some signals are inverted (so highest priority - handlers get executed last). Please see :ref:`signals reference ` + handlers get executed last). Please see :ref:`signals reference ` for details. """ diff --git a/wa/instrumentation/__init__.py b/wa/instruments/__init__.py similarity index 100% rename from wa/instrumentation/__init__.py rename to wa/instruments/__init__.py diff --git a/wa/instrumentation/dmesg.py b/wa/instruments/dmesg.py similarity index 98% rename from wa/instrumentation/dmesg.py rename to wa/instruments/dmesg.py index 87dbba04..8353188e 100644 --- a/wa/instrumentation/dmesg.py +++ b/wa/instruments/dmesg.py @@ -18,7 +18,7 @@ import os from wa import Instrument, Parameter from wa.framework.exception import InstrumentError -from wa.framework.instrumentation import slow +from wa.framework.instruments import slow from wa.utils.misc import ensure_file_directory_exists as _f class DmesgInstrument(Instrument): diff --git a/wa/instrumentation/energy_measurement.py b/wa/instruments/energy_measurement.py similarity index 99% rename from wa/instrumentation/energy_measurement.py rename to wa/instruments/energy_measurement.py index e71efead..3fac0e14 100644 --- a/wa/instrumentation/energy_measurement.py +++ b/wa/instruments/energy_measurement.py @@ -242,12 +242,12 @@ class EnergyMeasurement(Instrument): Parameter('instrument', kind=str, mandatory=True, allowed_values=['daq', 'energy_probe', 'acme_cape', 'monsoon', 'juno_readenergy'], description=""" - Specify the energy instrumentation to be enabled. + Specify the energy instruments to be enabled. """), Parameter('instrument_parameters', kind=dict, default={}, description=""" Specify the parameters used to initialize the desired - instrumentation. + instruments. """), Parameter('sites', kind=list_or_string, description=""" @@ -271,7 +271,7 @@ class EnergyMeasurement(Instrument): def __init__(self, target, loader=pluginloader, **kwargs): super(EnergyMeasurement, self).__init__(target, **kwargs) - self.instrumentation = None + self.instruments = None self.measurement_csvs = {} self.loader = loader self.backend = self.loader.get_plugin(self.instrument) diff --git a/wa/instrumentation/fps.py b/wa/instruments/fps.py similarity index 100% rename from wa/instrumentation/fps.py rename to wa/instruments/fps.py diff --git a/wa/instrumentation/hwmon.py b/wa/instruments/hwmon.py similarity index 98% rename from wa/instrumentation/hwmon.py rename to wa/instruments/hwmon.py index 71705c43..33e80a22 100644 --- a/wa/instrumentation/hwmon.py +++ b/wa/instruments/hwmon.py @@ -16,7 +16,7 @@ from devlib import HwmonInstrument as _Instrument from wa import Instrument -from wa.framework.instrumentation import fast +from wa.framework.instruments import fast MOMENTARY_QUANTITIES = ['temperature', 'power', 'voltage', 'current', 'fps'] CUMULATIVE_QUANTITIES = ['energy', 'tx', 'tx/rx', 'frames'] diff --git a/wa/instrumentation/misc.py b/wa/instruments/misc.py similarity index 99% rename from wa/instrumentation/misc.py rename to wa/instruments/misc.py index eaf02435..eed3f642 100644 --- a/wa/instrumentation/misc.py +++ b/wa/instruments/misc.py @@ -39,7 +39,7 @@ from devlib.utils.android import ApkInfo from wa import Instrument, Parameter, very_fast from wa.framework.exception import ConfigError -from wa.framework.instrumentation import slow +from wa.framework.instruments import slow from wa.utils.misc import as_relative, diff_tokens, write_table from wa.utils.misc import ensure_file_directory_exists as _f from wa.utils.misc import ensure_directory_exists as _d diff --git a/wa/instrumentation/poller/Makefile b/wa/instruments/poller/Makefile similarity index 100% rename from wa/instrumentation/poller/Makefile rename to wa/instruments/poller/Makefile diff --git a/wa/instrumentation/poller/__init__.py b/wa/instruments/poller/__init__.py similarity index 100% rename from wa/instrumentation/poller/__init__.py rename to wa/instruments/poller/__init__.py diff --git a/wa/instrumentation/poller/bin/arm64/poller b/wa/instruments/poller/bin/arm64/poller similarity index 100% rename from wa/instrumentation/poller/bin/arm64/poller rename to wa/instruments/poller/bin/arm64/poller diff --git a/wa/instrumentation/poller/bin/armeabi/poller b/wa/instruments/poller/bin/armeabi/poller similarity index 100% rename from wa/instrumentation/poller/bin/armeabi/poller rename to wa/instruments/poller/bin/armeabi/poller diff --git a/wa/instrumentation/poller/poller.c b/wa/instruments/poller/poller.c similarity index 100% rename from wa/instrumentation/poller/poller.c rename to wa/instruments/poller/poller.c diff --git a/wa/instrumentation/trace-cmd.py b/wa/instruments/trace-cmd.py similarity index 99% rename from wa/instrumentation/trace-cmd.py rename to wa/instruments/trace-cmd.py index 6ffc52de..fbc4a2ad 100644 --- a/wa/instrumentation/trace-cmd.py +++ b/wa/instruments/trace-cmd.py @@ -22,7 +22,7 @@ from devlib import FtraceCollector from wa import Instrument, Parameter from wa.framework import signal -from wa.framework.instrumentation import very_slow +from wa.framework.instruments import very_slow from wa.framework.exception import InstrumentError from wa.utils.types import list_of_strings from wa.utils.misc import which