diff options
author | Javi Merino <javi.merino@arm.com> | 2016-08-11 17:54:23 +0100 |
---|---|---|
committer | Javi Merino <javi.merino@arm.com> | 2016-08-12 11:41:58 +0100 |
commit | 956b609efec4c4823fa4a5c353eef0feba8a30c7 (patch) | |
tree | a6d4e96a1c8793cd1434b85eb65e44a108c83e67 /bart | |
parent | d77008c8d87eadb88b01ceaeda70650b7d364c8c (diff) | |
download | bart-956b609efec4c4823fa4a5c353eef0feba8a30c7.tar.gz |
sched: SchedMultiAssert: add getCPUBusyTime
For multiple tasks, it's valuable to verify that they have ran on a set
of cpus for a given time. With SchedMultiAssert.getCPUBusyTime() we can
do that now!
Diffstat (limited to 'bart')
-rwxr-xr-x | bart/sched/SchedMultiAssert.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bart/sched/SchedMultiAssert.py b/bart/sched/SchedMultiAssert.py index bc37798..32ea17d 100755 --- a/bart/sched/SchedMultiAssert.py +++ b/bart/sched/SchedMultiAssert.py @@ -227,6 +227,44 @@ class SchedMultiAssert(object): else: return result + def getCPUBusyTime(self, level, node, window=None, percent=False): + """Get the amount of time the cpus in the system were busy executing the + tasks + + :param level: The topological level to which the group belongs + :type level: string + + :param node: The group of CPUs for which to calculate busy time + :type node: list + + :param window: A (start, end) tuple to limit the scope of the + calculation. + :type window: tuple + + :param percent: If True the result is normalized to the total + time of the period, either the window or the full lenght of + the trace. + :type percent: bool + + .. math:: + + R = \\frac{T_{busy} \\times 100}{T_{total}} + + """ + residencies = self.getResidency(level, node, window=window) + + busy_time = sum(v["residency"] for v in residencies.itervalues()) + + if percent: + if window: + total_time = window[1] - window[0] + else: + total_time = self._ftrace.get_duration() + num_cpus = len(node) + return busy_time / (total_time * num_cpus) * 100 + else: + return busy_time + def generate_events(self, level, window=None): """Generate Events for the trace plot |