Add "no_idle" parameter to work around the problem where cores are
reported to be in "unknown" state if there are no cpuidle transitions in
the trace. If this parameter is set, cpustates will assume cores are
active without waiting for an idle transition.
This reverts commit 9bd745b347ef1a18a8b46a07cf5fa6dd3af642f8.
When a frequency is changed on a core, cpufreq reports a frequency
transition for all cores in the frequency domain. This means it is not
safe to assume a core is not idling just because there is a frequency
transition reported for it (that just means that there is at least one
core on that frequency domain that is not idling). Moreover, the
transitions are always reported in the same order so there is no way to
infer which core triggered it.
If a frequency transition is observed before an idle state can be
established, assume idle state is -1 (i.e. the core is running). This
will ensure correct stats for platforms with disabled cpuidle.
This commit resolves a couple of issues that were causing impropper
cluster shutdown tracking in the cpustates script.
- requested_states in the PowerStateProcessor was being initalized to -1
instead of None if no state was requested; the later checks are
against None.
- requested_states was not being set if the request could be satisfied
immediately, and was being cleared upon being statisfied at a later
time. This caused a problem when a core leaves idle and then tries to
re-enter cluster shutdown. Here is an example sequence of events that
illustrates the issue (assume core0 and core1 are the only two cores
on a cluster):
1. both cores are running
2. core0 requests cluster-sleep. As core1 is running, it
is put into core-sleep instead, and its request is saved.
3. core1 requests cluster-sleep. As core0 has a pending request
for cluster-sleep, both cores are put into cluster-sleep and
the pending request is cleared.
4. core1 becomes active. core0 is elevated to core-sleep.
5. core1 tries to enter cluster-sleep. Since core0 is currently
in core-sleep (and its prior request has laredy been
cleared), core1 is put into core-sleep instead, and its
request is saved. This is an ERROR as but cores have in fact
requested cluster-sleep at this stage.
If, in step 4., core0 becomes active instead, exactly the same
situation will result, as core1 was put into cluster-sleep immediately
and its request was never saved.
Idle state requests are now always tracked on entry and are only
cleared when the core leave idle.
- Also removed a pointless identy assignment.
Added an option to generate a timeline of state transitions, in
contrast to the existing timeline of computed states. This is primarily
intended for debugging of the latter, but may also be useful for certain
kinds of analyses.
When collecting ftrace events, the instrument will insert frequencies
into the trace to make it possible reconstruct power states when there
were no frequency transitions during the measured period.
The format in which frequencies are inserted is different in devlib.
Since post-processing scripts may be run on traces collected by devlib
as well as WA, it needs to support both formats.
When running the stand-alone cpustates script and specifying a timeline
file (which causes the corresponding reporter to be enabled), a
timeline report is generated in addition to the usual cpustates and
parallelism reports.
Up to this point, the main() of the stand-alone script was expecting
exactly two reports and so it crashing when running with the timeline
option. This commit fixes this case.
cpustates can now handle the lack of a start marker in three ways:
- try: If the start marker is present only the correct section of the trace
will be used, if its not the whole trace will be used.
- error: An error will be raised if the start marker is missing
- ignore: The markers are ignored and the whole trace is always used.
If an exception is raised inside a generator it cannot be continued.
To get around this exceptions are now caught and later output via the
logger.
Also added logger setup when running cpustates as a standalone script
Previously, only reports that were generated were returned. With this
commit, there will be an entry for each active reporter in the returned
list. If a reporter did not produce a valid report, the entry will be
None.
This ensures consistent output, even if a run time issue causes a
reporter not to produce a report (e.g. if cpufreq events were not
enabled).
Fixed error in percentage when frequency is 'None'. Now default to 0 in these cases
cpu_utilisation is now a separate parameter in cpustate. Now generates a floating point number representing the utilisation based on the maximum frequency of the capture. No longer performs averaging of values, this can be done as a post-processing step
cpu utilisation now based on the max cpu freq per core, not max captured freq overall
cpustate result processor generates a view of the cpu subsystem power
state during execution of a workload from cpu_idle and cpu_frequency
ftraces. There exists a period before the first events in those
categories are seen where the state of the cpu subsystem is (partially)
unknown and it is reported as such by the result processor.
Unknown state usually exists for a relatively short period of time and
is generally not a big deal. For certain kinds of workloads, however, it
may constitude a significant protion of the trace.
Changes in this commit attempt to deal with this by a) reading starting
cpu frequencies and writing them into the trace, and b) nudging each
core to bring it out of idle; this happens before the start marker, so
that the system state between the markers should be completely known.