Skip to content

Commit

Permalink
Merge pull request #968 from douglas-raillard-arm/_pr216
Browse files Browse the repository at this point in the history
lisa.tests.base: Introduce RTATestBundle.rtapp_tasks property
  • Loading branch information
douglas-raillard-arm committed Jul 1, 2019
2 parents 1ffb6da + 5b066ee commit cab1bee
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
14 changes: 11 additions & 3 deletions lisa/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,9 @@ def trace_window(self, trace):
sdf = trace.df_events('sched_switch')

# Find when the first task starts running
rta_start = sdf[sdf.next_comm.isin(self.rtapp_profile.keys())].index[0]
rta_start = sdf[sdf.next_comm.isin(self.rtapp_tasks)].index[0]
# Find when the last task stops running
rta_stop = sdf[sdf.prev_comm.isin(self.rtapp_profile.keys())].index[-1]
rta_stop = sdf[sdf.prev_comm.isin(self.rtapp_tasks)].index[-1]

return (rta_start, rta_stop)

Expand Down Expand Up @@ -628,6 +628,14 @@ def rtapp_profile(self):
"""
return self.get_rtapp_profile(self.plat_info)

@property
def rtapp_tasks(self):
"""
Sorted list of rtapp task names, as defined in ``rtapp_profile``
attribute.
"""
return sorted(self.rtapp_profile.keys())

@property
def cgroup_configuration(self):
"""
Expand Down Expand Up @@ -665,7 +673,7 @@ def test_noisy_tasks(self, noise_threshold_pct=None, noise_threshold_ms=None):
df = self.trace.analysis.tasks.df_tasks_runtime()

# We don't want to account the test tasks
ignored_pids = list(map(self.trace.get_task_pid, self.rtapp_profile.keys()))
ignored_pids = list(map(self.trace.get_task_pid, self.rtapp_tasks))

def compute_duration_pct(row):
return row.runtime * 100 / self.trace.time_range
Expand Down
4 changes: 2 additions & 2 deletions lisa/tests/scheduler/eas_behaviour.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _get_task_cpu_df(self):
:returns: A Pandas DataFrame with a column for each task, showing the
CPU that the task was "on" at each moment in time
"""
tasks = list(self.rtapp_profile.keys())
tasks = self.rtapp_tasks

df = self.trace.ftrace.sched_switch.data_frame[['next_comm', '__cpu']]
df = df[df['next_comm'].isin(tasks)]
Expand Down Expand Up @@ -264,7 +264,7 @@ def _get_estimated_power_df(self, nrg_model):
task_cpu_df = self._get_task_cpu_df()
task_utils_df = self._get_expected_task_utils_df(nrg_model)
task_utils_df.index = [time + self.trace.start for time in task_utils_df.index]
tasks = list(self.rtapp_profile.keys())
tasks = self.rtapp_tasks

# Create a combined DataFrame with the utilization of a task and the CPU
# it was running on at each moment. Looks like:
Expand Down
2 changes: 1 addition & 1 deletion lisa/tests/scheduler/load_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def task_name(self):
"""
The name of the only task this test uses
"""
return list(self.rtapp_profile.keys())[0]
return self.rtapp_tasks[0]

@LoadTrackingBase.get_task_sched_signal.used_events
def get_task_sched_signal(self, cpu, signal):
Expand Down
6 changes: 3 additions & 3 deletions lisa/tests/scheduler/misfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __init__(self, res_dir, plat_info):

sdf = sdf[self.trace.start + self.IDLING_DELAY_S * 0.9:]

for task in self.rtapp_profile.keys():
for task in self.rtapp_tasks:
task_cpu = int(task.strip("{}_".format(self.task_prefix)))
task_start = sdf[(sdf.next_comm == task) & (sdf["__cpu"] == task_cpu)].index[0]
last_start = max(last_start, task_start)
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_preempt_time(self, allowed_preempt_pct=1) -> ResultBundle:
sdf = self.trace.df_events('sched_switch')
task_state_dfs = {
task : self.trace.analysis.tasks.df_task_states(task)
for task in self.rtapp_profile.keys()
for task in self.rtapp_tasks
}

res = ResultBundle.from_bool(True)
Expand Down Expand Up @@ -314,7 +314,7 @@ def test_throughput(self, allowed_idle_time_s=None) -> ResultBundle:
:type allowed_idle_time_s: int
"""
task_state_dfs = {}
for task in self.rtapp_profile.keys():
for task in self.rtapp_tasks:
# This test is all about throughput: check that every time a task
# runs on a little it's because bigs are busy
df = self.trace.analysis.tasks.df_task_states(task)
Expand Down
4 changes: 2 additions & 2 deletions lisa/tests/staging/sched_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ def test_stune_task_placement(self, bad_cpu_margin_pct=10) -> ResultBundle:
their time on CPUs that don't have enough capacity to serve their
boost.
"""
assert len(self.rtapp_profile) == 1
task = list(self.rtapp_profile.keys())[0]
assert len(self.rtapp_tasks) == 1
task = self.rtapp_tasks[0]
df = self.trace.analysis.tasks.df_task_total_residency(task)

# Find CPUs without enough capacity to meet the boost
Expand Down

0 comments on commit cab1bee

Please sign in to comment.