diff --git a/lisa/tests/base.py b/lisa/tests/base.py index 5d8e10033e303dd5efc70f466bca1c10a449866f..2cf1d49eab839b901bfb32f1ed19452684a3c2ba 100644 --- a/lisa/tests/base.py +++ b/lisa/tests/base.py @@ -350,11 +350,7 @@ class TestBundle(Serializable, abc.ABC): class RTATestBundle(TestBundle): """ - "Abstract" class for :class:`lisa.wlgen.rta.RTA`-powered TestBundles - - :param rtapp_profile: The rtapp parameters used to create the synthetic - workload. That happens to be what is returned by :meth:`get_rtapp_profile` - :type rtapp_profile: dict + Abstract Base Class for :class:`lisa.wlgen.rta.RTA`-powered TestBundles """ TRACE_PATH = 'trace.dat' @@ -431,9 +427,12 @@ class RTATestBundle(TestBundle): trace = Trace(path, self.plat_info, events=self.ftrace_conf["events"]) return trace.get_view(self.trace_window(trace)) - def __init__(self, res_dir, plat_info, rtapp_profile): - super().__init__(res_dir, plat_info) - self.rtapp_profile = rtapp_profile + @property + def rtapp_profile(self): + """ + Compute the RTapp profile based on ``plat_info``. + """ + return self.get_rtapp_profile(self.plat_info) @TasksAnalysis.df_tasks_runtime.used_events def test_noisy_tasks(self, noise_threshold_pct=None, noise_threshold_ms=None): @@ -602,6 +601,6 @@ class RTATestBundle(TestBundle): rtapp_profile = cls.get_rtapp_profile(plat_info) cls._run_rtapp(target, res_dir, rtapp_profile, ftrace_coll) - return cls(res_dir, plat_info, rtapp_profile) + return cls(res_dir, plat_info) # vim :set tabstop=4 shiftwidth=4 textwidth=80 expandtab diff --git a/lisa/tests/scheduler/eas_behaviour.py b/lisa/tests/scheduler/eas_behaviour.py index 3970ddcbc6bac084d91de7a4540cdb6cae6e879c..e7e09b02539e9f0166d824c9e60d1e8e7fba4182 100644 --- a/lisa/tests/scheduler/eas_behaviour.py +++ b/lisa/tests/scheduler/eas_behaviour.py @@ -40,10 +40,6 @@ class EASBehaviour(RTATestBundle): """ Abstract class for EAS behavioural testing. - :param rtapp_profile: The rtapp parameters used to create the synthetic - workload. That happens to be what is returned by :meth:`get_rtapp_profile` - :type rtapp_profile: dict - :param nrg_model: The energy model of the platform the synthetic workload was run on :type nrg_model: EnergyModel @@ -59,15 +55,6 @@ class EASBehaviour(RTATestBundle): def nrg_model(self): return self.plat_info['nrg-model'] - @classmethod - @abc.abstractmethod - def get_rtapp_profile(cls, plat_info): - """Returns the RTapp profile for the given :class:`lisa.platforms.platinfo.PlatformInfo`. - - :returns: :class:`lisa.wlgen.rta.RTATask` - """ - pass - @classmethod def check_from_target(cls, target): for domain in target.cpufreq.iter_domains(): @@ -89,14 +76,15 @@ class EASBehaviour(RTATestBundle): with target.cpufreq.use_governor("schedutil"): cls._run_rtapp(target, res_dir, rtapp_profile, ftrace_coll=ftrace_coll) - return cls(res_dir, plat_info, rtapp_profile) + return cls(res_dir, plat_info) @classmethod def from_target(cls, target:Target, res_dir:ArtifactPath=None, ftrace_coll:FtraceCollector=None) -> 'EASBehaviour': """ Factory method to create a bundle using a live target - This will execute the rt-app workload described in :meth:`get_rtapp_profile` + This will execute the rt-app workload described in + :meth:`lisa.tests.base.RTATestBundle.get_rtapp_profile` """ return super().from_target(target, res_dir, ftrace_coll=ftrace_coll) diff --git a/lisa/tests/scheduler/load_tracking.py b/lisa/tests/scheduler/load_tracking.py index 2f581b0a02c5a5e55093e54c0e57a06110fb5895..261e1428d72359282c71b77c5549e424c88e8475 100644 --- a/lisa/tests/scheduler/load_tracking.py +++ b/lisa/tests/scheduler/load_tracking.py @@ -194,7 +194,7 @@ class LoadTrackingBase(RTATestBundle, LoadTrackingHelpers): with target.cpufreq.use_governor(**cls.cpufreq_conf): cls._run_rtapp(target, res_dir, rtapp_profile, ftrace_coll) - return cls(res_dir, plat_info, rtapp_profile) + return cls(res_dir, plat_info) def get_task_sched_signals(self, trace, cpu, task_name): """ @@ -240,13 +240,17 @@ class InvarianceItem(LoadTrackingBase): "governor" : "userspace" } - def __init__(self, res_dir, plat_info, rtapp_profile, cpu, freq, freq_list): - super().__init__(res_dir, plat_info, rtapp_profile) + def __init__(self, res_dir, plat_info, cpu, freq, freq_list): + super().__init__(res_dir, plat_info) self.freq = freq self.freq_list = freq_list self.cpu = cpu + @property + def rtapp_profile(self): + return self.get_rtapp_profile(self.plat_info, cpu=self.cpu) + @classmethod def get_rtapp_profile(cls, plat_info, cpu): """ @@ -285,7 +289,7 @@ class InvarianceItem(LoadTrackingBase): logger.debug('CPU{} frequency: {}'.format(cpu, target.cpufreq.get_frequency(cpu))) cls._run_rtapp(target, res_dir, rtapp_profile, ftrace_coll) - return cls(res_dir, plat_info, rtapp_profile, cpu, freq, freq_list) + return cls(res_dir, plat_info, cpu, freq, freq_list) def get_expected_util_avg(self, trace, cpu, task_name, capacity): """ @@ -895,8 +899,8 @@ class CPUMigrationBase(LoadTrackingBase): super()._run_rtapp(target, res_dir, profile, ftrace_coll) - def __init__(self, res_dir, plat_info, rtapp_profile): - super().__init__(res_dir, plat_info, rtapp_profile) + def __init__(self, res_dir, plat_info): + super().__init__(res_dir, plat_info) self.cpus = set() diff --git a/lisa/tests/scheduler/misfit.py b/lisa/tests/scheduler/misfit.py index 4330f202cae1921591ba363086227db4fa3c81bc..0e23d49f96f08c9d9f26301e58d26081646d095d 100644 --- a/lisa/tests/scheduler/misfit.py +++ b/lisa/tests/scheduler/misfit.py @@ -122,8 +122,8 @@ class StaggeredFinishes(MisfitMigrationBase): rq->avg_idle > sysctl_sched_migration_cost """ - def __init__(self, res_dir, plat_info, rtapp_profile): - super().__init__(res_dir, plat_info, rtapp_profile) + def __init__(self, res_dir, plat_info): + super().__init__(res_dir, plat_info) sdf = self.trace.df_events('sched_switch')