1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-19 04:21:17 +00:00

Merge pull request #418 from setrofim/master

cpustates: workaround for disabled cpuidle
This commit is contained in:
marcbonnici 2017-06-21 15:31:47 +01:00 committed by GitHub
commit 0c0ccb10d9
2 changed files with 31 additions and 6 deletions

View File

@ -122,6 +122,20 @@ class CpuStatesProcessor(ResultProcessor):
:`error`: An error will be raised if the start marker is not found in the trace.
:`try`: If the start marker is not found, all events in the trace will be used.
""")
Parameter('no_idle', kind=bool, default=False,
description="""
Indicate that there will be no idle transitions in the trace. By default, a core
will be reported as being in an "unknown" state until the first idle transtion for
that core. Normally, this is not an issue, as cores are "nudged" as part of the setup
to ensure that there is an idle transtion before the meassured region. However, if all
idle states for the core have been disabled, or if the kernel does not have cpuidle,
the nudge will not result in an idle transition, which would cause the cores to be
reported to be in "unknown" state for the entire execution.
If this parameter is set to ``True``, the processor will assuming that cores are
running prior to the begining of the issue, and they will leave unknown state on
the first frequency transition.
"""),
]
def validate(self):
@ -215,6 +229,7 @@ class CpuStatesProcessor(ResultProcessor):
cpu_utilisation=cpu_utilisation,
max_freq_list=self.max_freq_list,
start_marker_handling=self.start_marker_handling,
no_idle=self.no_idle,
)
parallel_report = reports.pop(0)
powerstate_report = reports.pop(0)

View File

@ -113,11 +113,12 @@ class SystemPowerState(object):
def num_cores(self):
return len(self.cpus)
def __init__(self, num_cores):
def __init__(self, num_cores, no_idle=False):
self.timestamp = None
self.cpus = []
idle_state = -1 if no_idle else None
for _ in xrange(num_cores):
self.cpus.append(CpuPowerState())
self.cpus.append(CpuPowerState(idle_state=idle_state))
def copy(self):
new = SystemPowerState(self.num_cores)
@ -154,8 +155,8 @@ class PowerStateProcessor(object):
def __init__(self, core_clusters, num_idle_states,
first_cluster_state=sys.maxint, first_system_state=sys.maxint,
wait_for_start_marker=False):
self.power_state = SystemPowerState(len(core_clusters))
wait_for_start_marker=False, no_idle=False):
self.power_state = SystemPowerState(len(core_clusters), no_idle=no_idle)
self.requested_states = {} # cpu_id -> requeseted state
self.wait_for_start_marker = wait_for_start_marker
self._saw_start_marker = False
@ -650,7 +651,7 @@ def report_power_stats(trace_file, idle_state_names, core_names, core_clusters,
first_system_state=sys.maxint, use_ratios=False,
timeline_csv_file=None, cpu_utilisation=None,
max_freq_list=None, start_marker_handling='error',
transitions_csv_file=None):
transitions_csv_file=None, no_idle=False):
# pylint: disable=too-many-locals,too-many-branches
trace = TraceCmdTrace(trace_file,
filter_markers=False,
@ -671,7 +672,8 @@ def report_power_stats(trace_file, idle_state_names, core_names, core_clusters,
num_idle_states=num_idle_states,
first_cluster_state=first_cluster_state,
first_system_state=first_system_state,
wait_for_start_marker=wait_for_start_marker)
wait_for_start_marker=wait_for_start_marker,
no_idle=no_idle)
reporters = [
ParallelStats(core_clusters, use_ratios),
PowerStateStats(core_names, idle_state_names, use_ratios)
@ -731,6 +733,7 @@ def main():
max_freq_list=args.max_freq_list,
start_marker_handling=args.start_marker_handling,
transitions_csv_file=args.transitions_file,
no_idle=args.no_idle,
)
parallel_report = reports.pop(0)
@ -833,6 +836,13 @@ def parse_arguments(): # NOQA
error: An error will be raised if the start marker is not found in the trace.
try: If the start marker is not found, all events in the trace will be used.
''')
parser.add_argument('-N', '--no-idle', action='store_true',
help='''
Assume that cpuidle is not present or disabled on the system, and therefore that the
initial state of the cores is that they are running. This flag is necessary because
the processor assumes the cores are in an unknown state until it sees the first idle
transition, which will never come if cpuidle is absent.
''')
args = parser.parse_args()