From d60034f7d71ce82078b30db78fd1fd05900cfd32 Mon Sep 17 00:00:00 2001 From: Vasilis Flouris Date: Wed, 3 Jun 2015 16:40:39 +0100 Subject: [PATCH 1/3] Allows running the energy instrument without hotplugging --- .../instrumentation/energy_model/__init__.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/wlauto/instrumentation/energy_model/__init__.py b/wlauto/instrumentation/energy_model/__init__.py index bcbcefab..9928c881 100644 --- a/wlauto/instrumentation/energy_model/__init__.py +++ b/wlauto/instrumentation/energy_model/__init__.py @@ -352,6 +352,9 @@ class EnergyModelInstrument(Instrument): description='''The index of the first cluster idle state on the device. Previous states are assumed to be core idles. The default is ``-1``, i.e. only the last idle state is assumed to affect the entire cluster.'''), + Parameter('no_hotplug', kind=bool, default=False, + description='''This options allows running the instrument without hotpluging cores on and off. + Disabling hotplugging will most likely produce a less accurate power model.'''), ] def validate(self): @@ -377,6 +380,7 @@ class EnergyModelInstrument(Instrument): self.device_name = self.device.name def initialize(self, context): + self.number_of_cpus = {} self.report_template_file = context.resolver.get(File(self, REPORT_TEMPLATE_FILE)) self.em_template_file = context.resolver.get(File(self, EM_TEMPLATE_FILE)) self.little_core = (set(self.device.core_names) - set([self.big_core])).pop() @@ -437,6 +441,10 @@ class EnergyModelInstrument(Instrument): index_matter = [cluster, spec.num_cpus, spec.idle_state_id, spec.idle_state_desc, context.result.iteration] data = self.idle_data + if self.no_hotplug: + # due to that fact that hotpluging was disabled, power has to be artificially scaled + # to the number of cores that should have been active if hotplugging had occurred. + power_metric = spec.num_cpus * (power_metric / self.number_of_cpus[cluster]) data.append(index_matter + ['performance', perf_metric]) data.append(index_matter + ['{}_power'.format(self.get_core_name(cluster)), power_metric]) @@ -598,7 +606,7 @@ class EnergyModelInstrument(Instrument): def get_cluster_specs(self, old_specs, cluster, context): core = self.get_core_name(cluster) - number_of_cpus = sum([1 for c in self.device.core_names if c == core]) + self.number_of_cpus[cluster] = sum([1 for c in self.device.core_names if c == core]) cluster_frequencies = self.get_frequencies_param(cluster) if not cluster_frequencies: @@ -607,13 +615,14 @@ class EnergyModelInstrument(Instrument): idle_states = self.get_device_idle_states(cluster) new_specs = [] for state in idle_states: - for num_cpus in xrange(1, number_of_cpus + 1): + for num_cpus in xrange(1, self.number_of_cpus[cluster] + 1): spec = old_specs[0].copy() spec.workload_name = self.idle_workload spec.workload_parameters = self.idle_workload_params spec.idle_state_id = state.id spec.idle_state_desc = state.desc - spec.runtime_parameters['{}_cores'.format(core)] = num_cpus + if not self.no_hotplug: + spec.runtime_parameters['{}_cores'.format(core)] = num_cpus spec.cluster = cluster spec.num_cpus = num_cpus spec.id = '{}_idle_{}_{}'.format(cluster, state.id, num_cpus) @@ -627,10 +636,11 @@ class EnergyModelInstrument(Instrument): if old_spec.workload_name != 'sysbench': raise ConfigError('Only sysbench workload currently supported for energy_model generation.') for freq in cluster_frequencies: - for num_cpus in xrange(1, number_of_cpus + 1): + for num_cpus in xrange(1, self.number_of_cpus[cluster] + 1): spec = old_spec.copy() spec.runtime_parameters['{}_frequency'.format(core)] = freq - spec.runtime_parameters['{}_cores'.format(core)] = num_cpus + if not self.no_hotplug: + spec.runtime_parameters['{}_cores'.format(core)] = num_cpus spec.id = '{}_{}_{}'.format(cluster, num_cpus, freq) spec.label = 'freq_{}_{}'.format(cluster, spec.label) spec.workload_parameters['taskset_mask'] = list_to_mask(self.get_cpus(cluster)) From 1a604ac2e3e5975e2aa88e157430a65e937fe0d8 Mon Sep 17 00:00:00 2001 From: Vasilis Flouris Date: Wed, 3 Jun 2015 16:43:45 +0100 Subject: [PATCH 2/3] Fixes a bug in energy model instrument --- wlauto/instrumentation/energy_model/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wlauto/instrumentation/energy_model/__init__.py b/wlauto/instrumentation/energy_model/__init__.py index 9928c881..c7212cd9 100644 --- a/wlauto/instrumentation/energy_model/__init__.py +++ b/wlauto/instrumentation/energy_model/__init__.py @@ -447,7 +447,7 @@ class EnergyModelInstrument(Instrument): power_metric = spec.num_cpus * (power_metric / self.number_of_cpus[cluster]) data.append(index_matter + ['performance', perf_metric]) - data.append(index_matter + ['{}_power'.format(self.get_core_name(cluster)), power_metric]) + data.append(index_matter + ['power', power_metric]) def before_overall_results_processing(self, context): # pylint: disable=too-many-locals From afa2b11975d6763dc112adeab785a8480f2dc63a Mon Sep 17 00:00:00 2001 From: Vasilis Flouris Date: Wed, 3 Jun 2015 16:45:52 +0100 Subject: [PATCH 3/3] Adds copyright header to energy model instrument --- wlauto/instrumentation/energy_model/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wlauto/instrumentation/energy_model/__init__.py b/wlauto/instrumentation/energy_model/__init__.py index c7212cd9..6c13b127 100644 --- a/wlauto/instrumentation/energy_model/__init__.py +++ b/wlauto/instrumentation/energy_model/__init__.py @@ -1,3 +1,19 @@ +# Copyright 2015 ARM Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + #pylint: disable=attribute-defined-outside-init,access-member-before-definition,redefined-outer-name from __future__ import division import os