1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-22 12:58:36 +00:00

Merge pull request #525 from setrofim/next

Fixes.
This commit is contained in:
setrofim 2017-10-23 18:04:25 +01:00 committed by GitHub
commit 829ac73f06
3 changed files with 48 additions and 43 deletions

View File

@ -343,7 +343,7 @@ class Executor(object):
counter = context.run_state.get_status_counts() counter = context.run_state.get_status_counts()
parts = [] parts = []
for status in reversed(Status.values): for status in reversed(Status.levels):
if status in counter: if status in counter:
parts.append('{} {}'.format(counter[status], status)) parts.append('{} {}'.format(counter[status], status))
self.logger.info(status_summary + ', '.join(parts)) self.logger.info(status_summary + ', '.join(parts))

View File

@ -76,7 +76,7 @@ class RunState(object):
@property @property
def num_completed_jobs(self): def num_completed_jobs(self):
return sum(1 for js in self.jobs.itervalues() return sum(1 for js in self.jobs.itervalues()
if js.status > Status.SKIPPED) if js.status > Status.RUNNING)
def __init__(self): def __init__(self):
self.jobs = OrderedDict() self.jobs = OrderedDict()

View File

@ -1,5 +1,6 @@
import logging import logging
from collections import defaultdict, OrderedDict from collections import defaultdict, OrderedDict
from copy import copy
from wa.framework.exception import ConfigError from wa.framework.exception import ConfigError
from wa.framework.plugin import Plugin, Parameter from wa.framework.plugin import Plugin, Parameter
@ -255,10 +256,8 @@ class FreqValue(object):
return value return value
elif isinstance(value, basestring): elif isinstance(value, basestring):
value = caseless_string(value) value = caseless_string(value)
if value == 'max': if value in ['min', 'max']:
return self.values[-1] return value
elif value == 'min':
return self.values[0]
msg = 'Invalid frequency value: {}; Must be in {}' msg = 'Invalid frequency value: {}; Must be in {}'
raise ValueError(msg.format(value, self.values)) raise ValueError(msg.format(value, self.values))
@ -266,6 +265,7 @@ class FreqValue(object):
def __str__(self): def __str__(self):
return 'valid frequency value: {}'.format(self.values) return 'valid frequency value: {}'.format(self.values)
class CpufreqRuntimeConfig(RuntimeConfig): class CpufreqRuntimeConfig(RuntimeConfig):
name = 'rt-cpufreq' name = 'rt-cpufreq'
@ -311,35 +311,34 @@ class CpufreqRuntimeConfig(RuntimeConfig):
return return
self._retrive_cpufreq_info() self._retrive_cpufreq_info()
common_freqs, common_gov = self._get_common_values() all_freqs, common_freqs, common_gov = self._get_common_values()
# Add common parameters if available. # Add common parameters if available.
if common_freqs: freq_val = FreqValue(all_freqs)
freq_val = FreqValue(common_freqs) param_name = 'frequency'
param_name = 'frequency' self._runtime_params[param_name] = \
self._runtime_params[param_name] = \ RuntimeParameter(param_name, kind=freq_val,
RuntimeParameter(param_name, kind=freq_val, setter=self.set_frequency,
setter=self.set_frequency, setter_params={'core': None},
setter_params={'core': None}, description="""
description=""" The desired frequency for all cores
The desired frequency for all cores """)
""") param_name = 'max_frequency'
param_name = 'max_frequency' self._runtime_params[param_name] = \
self._runtime_params[param_name] = \ RuntimeParameter(param_name, kind=freq_val,
RuntimeParameter(param_name, kind=freq_val, setter=self.set_max_frequency,
setter=self.set_max_frequency, setter_params={'core': None},
setter_params={'core': None}, description="""
description=""" The maximum frequency for all cores
The maximum frequency for all cores """)
""") param_name = 'min_frequency'
param_name = 'min_frequency' self._runtime_params[param_name] = \
self._runtime_params[param_name] = \ RuntimeParameter(param_name, kind=freq_val,
RuntimeParameter(param_name, kind=freq_val, setter=self.set_min_frequency,
setter=self.set_min_frequency, setter_params={'core': None},
setter_params={'core': None}, description="""
description=""" The minimum frequency for all cores
The minimum frequency for all cores """)
""")
if common_gov: if common_gov:
param_name = 'governor' param_name = 'governor'
@ -351,6 +350,7 @@ class CpufreqRuntimeConfig(RuntimeConfig):
description=""" description="""
The governor to be set for all cores The governor to be set for all cores
""") """)
param_name = 'governor_tunables' param_name = 'governor_tunables'
self._runtime_params[param_name] = \ self._runtime_params[param_name] = \
RuntimeParameter(param_name, kind=dict, RuntimeParameter(param_name, kind=dict,
@ -544,8 +544,14 @@ class CpufreqRuntimeConfig(RuntimeConfig):
self.configure_governor(cpu, self.configure_governor(cpu,
config.get('governor'), config.get('governor'),
config.get('governor_tunables')) config.get('governor_tunables'))
frequency = config.get('frequency')
if frequency == 'min':
frequency = self.target.cpufreq.get_min_frequency(cpu)
elif frequency == 'max':
frequency = self.target.cpufreq.get_max_frequency(cpu)
self.configure_frequency(cpu, self.configure_frequency(cpu,
config.get('frequency'), frequency,
config.get('min_frequency'), config.get('min_frequency'),
config.get('max_frequency'), config.get('max_frequency'),
config.get('governor')) config.get('governor'))
@ -647,21 +653,20 @@ class CpufreqRuntimeConfig(RuntimeConfig):
''' Find common values for frequency and governors across all cores''' ''' Find common values for frequency and governors across all cores'''
common_freqs = None common_freqs = None
common_gov = None common_gov = None
all_freqs = None
initialized = False initialized = False
for cpu in resolve_unique_domain_cpus('all', self.target): for cpu in resolve_unique_domain_cpus('all', self.target):
if not initialized: if not initialized:
initialized = True initialized = True
if self.supported_cpu_freqs.get(cpu): common_freqs = set(self.supported_cpu_freqs.get(cpu) or [])
common_freqs = set(self.supported_cpu_freqs.get(cpu)) all_freqs = copy(common_freqs)
if self.supported_cpu_governors.get(cpu): common_gov = set(self.supported_cpu_governors.get(cpu) or [])
common_gov = set(self.supported_cpu_governors.get(cpu))
else: else:
if self.supported_cpu_freqs.get(cpu): common_freqs = common_freqs.intersection(self.supported_cpu_freqs.get(cpu) or set())
common_freqs = common_freqs.intersection(self.supported_cpu_freqs.get(cpu)) all_freqs = all_freqs.union(self.supported_cpu_freqs.get(cpu) or set())
if self.supported_cpu_governors.get(cpu): common_gov = common_gov.intersection(self.supported_cpu_governors.get(cpu))
common_gov = common_gov.intersection(self.supported_cpu_governors.get(cpu))
return common_freqs, common_gov return all_freqs, common_freqs, common_gov
class IdleStateValue(object): class IdleStateValue(object):