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

energy_model: further fixes to idle measurement.

- Fix to core frequency to min
- Only disable idle states that are deeper than the measured state.
  Keep shallower states enabed.
This commit is contained in:
Sergei Trofimov 2015-08-28 17:11:04 +01:00
parent 4389a7d350
commit 1b6b0907f9
2 changed files with 10 additions and 5 deletions

View File

@ -475,10 +475,10 @@ class EnergyModelInstrument(Instrument):
if not context.spec.label.startswith('idle_'):
return
for idle_state in self.get_device_idle_states(self.measured_cluster):
if idle_state.id == context.spec.idle_state_id:
idle_state.disable = 0
else:
if idle_state.id > context.spec.idle_state_index:
idle_state.disable = 1
else:
idle_state.disable = 0
def fast_start(self, context): # pylint: disable=unused-argument
self.start_time = time.time()
@ -718,6 +718,7 @@ class EnergyModelInstrument(Instrument):
cluster_frequencies = self.get_frequencies_param(cluster)
if not cluster_frequencies:
raise InstrumentError('Could not read available frequencies for {}'.format(core))
min_frequency = min(cluster_frequencies)
idle_states = self.get_device_idle_states(cluster)
new_specs = []
@ -728,8 +729,10 @@ class EnergyModelInstrument(Instrument):
spec.workload_parameters = self.idle_workload_params
spec.idle_state_id = state.id
spec.idle_state_desc = state.desc
spec.idle_state_index = state.index
if not self.no_hotplug:
spec.runtime_parameters['{}_cores'.format(core)] = num_cpus
spec.runtime_parameters['{}_frequency'.format(core)] = min_frequency
spec.cluster = cluster
spec.num_cpus = num_cpus
spec.id = '{}_idle_{}_{}'.format(cluster, state.id, num_cpus)

View File

@ -45,8 +45,9 @@ class CpuidleState(object):
raise ValueError('invalid idle state name: "{}"'.format(self.id))
return int(self.id[i:])
def __init__(self, device, path):
def __init__(self, device, index, path):
self.device = device
self.index = index
self.path = path
self.id = self.device.path.basename(self.path)
self.cpu = self.device.path.basename(self.device.path.dirname(path))
@ -106,7 +107,8 @@ class Cpuidle(Module):
idle_states = []
for state in self.device.listdir(states_dir):
if state.startswith('state'):
idle_states.append(CpuidleState(self.device, self.device.path.join(states_dir, state)))
index = int(state[5:])
idle_states.append(CpuidleState(self.device, index, self.device.path.join(states_dir, state)))
return idle_states
def _on_device_init(self, context): # pylint: disable=unused-argument