aboutsummaryrefslogtreecommitdiff
path: root/bart/sched/SchedAssert.py
diff options
context:
space:
mode:
Diffstat (limited to 'bart/sched/SchedAssert.py')
-rwxr-xr-xbart/sched/SchedAssert.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bart/sched/SchedAssert.py b/bart/sched/SchedAssert.py
index dd0b427..5ecfec9 100755
--- a/bart/sched/SchedAssert.py
+++ b/bart/sched/SchedAssert.py
@@ -612,6 +612,19 @@ class SchedAssert(object):
cpus = Utils.listify(cpus)
return first_cpu in cpus
+ def getLastCpu(self, window=None):
+ """Return the last CPU the task ran on"""
+
+ agg = self._aggregator(sched_funcs.last_cpu)
+ result = agg.aggregate(level="cpu", window=window)
+ result = list(itertools.chain.from_iterable(result))
+
+ end_time = max(result)
+ if not end_time:
+ return -1
+
+ return result.index(end_time)
+
def generate_events(self, level, start_id=0, window=None):
"""Generate events for the trace plot