示例#1
0
    def test_get_runtime(self):

        r = trappy.Run()
        # The ls process is process we are
        # testing against with pre calculated
        # values
        process = "ls"

        # Complete duration
        expected_time = 0.0034740000264719129
        s = SchedAssert(r, self.topology, execname=process)
        self.assertAlmostEqual(s.getRuntime(), expected_time, places=9)
        self.assertAlmostEqual(s.getRuntime(), expected_time, places=9)

        # Non Interrupted Window
        window = (0.0034, 0.003525)
        expected_time = 0.000125
        self.assertAlmostEqual(s.getRuntime(window=window), expected_time,
                               places=9)

        # Interrupted Window
        window = (0.0030, 0.0032)
        expected_time = 0.000166
        self.assertAlmostEqual(s.getRuntime(window=window), expected_time,
                               places=9)

        # A window with multiple interruptions
        window = (0.0027, 0.0036)
        expected_time = 0.000817
        self.assertAlmostEqual(s.getRuntime(window=window), expected_time,
                               places=9)
示例#2
0
    def calculate_end_times(cls):

        end_times = {}
        for task in cls.params.keys():
            sched_assert = SchedAssert(cls.trace, cls.env.topology,
                                       execname=task)
            end_times[task] = sched_assert.getEndTime()

        return end_times
示例#3
0
    def calculate_end_times(cls):

        end_times = {}
        for task in cls.params.keys():
            sched_assert = SchedAssert(cls.trace,
                                       cls.env.topology,
                                       execname=task)
            end_times[task] = sched_assert.getEndTime()

        return end_times
示例#4
0
    def get_end_times(self, experiment):
        """
        Get the time at which each task in the workload finished

        Returned as a dict; {"task_name": finish_time, ...}
        """

        end_times = {}
        ftrace = self.get_trace(experiment).ftrace
        for task in experiment.wload.tasks.keys():
            sched_assert = SchedAssert(ftrace, self.te.topology, execname=task)
            end_times[task] = sched_assert.getEndTime()

        return end_times
示例#5
0
文件: test.py 项目: msrasmussen/lisa
    def get_end_times(self, experiment):
        """
        Get the time at which each task in the workload finished

        Returned as a dict; {"task_name": finish_time, ...}
        """

        end_times = {}
        ftrace = self.get_trace(experiment).ftrace
        for task in experiment.wload.tasks.keys():
            sched_assert = SchedAssert(ftrace, self.te.topology, execname=task)
            end_times[task] = sched_assert.getEndTime()

        return end_times
示例#6
0
    def test_all_tasks_finish_on_a_big_cpu(self):
        """Offload Migration and Idle Pull: All tasks finish on a big cpu

        Note: this test may fail in big.LITTLE systems where the
        little cpus' performance is comparable to the bigs' and they
        can take almost the same time as a big cpu to complete a
        task.

        """

        for task in self.params.keys():
            sa = SchedAssert(self.trace, self.env.topology, execname=task)

            msg = "Task {} did not finish on a big cpu".format(task)
            self.assertIn(sa.getLastCpu(), self.env.target.bl.bigs, msg=msg)
示例#7
0
    def test_all_tasks_finish_on_a_big_cpu(self):
        """Offload Migration and Idle Pull: All tasks finish on a big cpu

        Note: this test may fail in big.LITTLE systems where the
        little cpus' performance is comparable to the bigs' and they
        can take almost the same time as a big cpu to complete a
        task.

        """

        for task in self.params.keys():
            sa = SchedAssert(self.trace, self.env.topology, execname=task)

            msg = "Task {} did not finish on a big cpu".format(task)
            self.assertIn(sa.getLastCpu(), self.env.target.bl.bigs, msg=msg)
示例#8
0
 def get_sched_assert(self, experiment, task):
     """
     Return a SchedAssert over the task provided
     """
     return SchedAssert(self.get_trace(experiment).ftrace,
                        self.te.topology,
                        execname=task)
示例#9
0
    def get_task_duty_cycle_pct(cls, trace, task_name, cpu):
        window = cls.get_task_window(trace, task_name, cpu)

        top = Topology()
        top.add_to_level('cpu', [[cpu]])
        return SchedAssert(trace._ftrace, top,
                           execname=task_name).getDutyCycle(window)
示例#10
0
    def test_all_tasks_run_on_a_big_cpu(self):
        """Offload Migration and Idle Pull: All tasks run on a big cpu at some point

        Note: this test may fail in big.LITTLE platforms in which the
        little cpus are almost as performant as the big ones.

        """

        for task in self.params.keys():
            sa = SchedAssert(self.trace, self.env.topology, execname=task)
            window = (0, self.end_times[task])
            big_residency = sa.getResidency("cluster", self.env.target.bl.bigs,
                                            window=window, percent=True)
            log_result(big_residency, self.log_fh)

            msg = "Task {} didn't run on a big cpu.".format(task)
            self.assertGreater(big_residency, 0, msg=msg)
    def _populate_asserts(self):
        """Populate SchedAsserts for the PIDs"""

        asserts = {}

        for pid in self._pids:
            asserts[pid] = SchedAssert(self._ftrace, self._topology, pid=pid)

        return asserts
示例#12
0
    def test_all_tasks_run_on_a_big_cpu(self):
        """Offload Migration and Idle Pull: All tasks run on a big cpu at some point

        Note: this test may fail in big.LITTLE platforms in which the
        little cpus are almost as performant as the big ones.

        """

        for task in self.params.keys():
            sa = SchedAssert(self.trace, self.env.topology, execname=task)
            window = (0, self.end_times[task])
            big_residency = sa.getResidency("cluster",
                                            self.env.target.bl.bigs,
                                            window=window,
                                            percent=True)
            log_result(big_residency, self.log_fh)

            msg = "Task {} didn't run on a big cpu.".format(task)
            self.assertGreater(big_residency, 0, msg=msg)
示例#13
0
    def test_get_runtime(self):

        r = trappy.Run()
        # The ls process is process we are
        # testing against with pre calculated
        # values
        process = "ls"

        # Complete duration
        expected_time = 0.0034740000264719129
        s = SchedAssert(r, self.topology, execname=process)
        self.assertAlmostEqual(s.getRuntime(), expected_time, places=9)
        self.assertAlmostEqual(s.getRuntime(), expected_time, places=9)

        # Non Interrupted Window
        window = (0.0034, 0.003525)
        expected_time = 0.000125
        self.assertAlmostEqual(s.getRuntime(window=window),
                               expected_time,
                               places=9)

        # Interrupted Window
        window = (0.0030, 0.0032)
        expected_time = 0.000166
        self.assertAlmostEqual(s.getRuntime(window=window),
                               expected_time,
                               places=9)

        # A window with multiple interruptions
        window = (0.0027, 0.0036)
        expected_time = 0.000817
        self.assertAlmostEqual(s.getRuntime(window=window),
                               expected_time,
                               places=9)
    def test_get_last_cpu(self):
        """SchedAssert.getLastCpu() gives you the last cpu in which a task ran"""
        expected_last_cpu = 5

        sa = SchedAssert("trace.dat", self.topology, execname="ls")
        self.assertEqual(sa.getLastCpu(), expected_last_cpu)
示例#15
0
 def get_offset(cls, task_name):
     return SchedAssert(cls.trace_file,
                        cls.env.topology,
                        execname=task_name).getStartTime()
示例#16
0
    def test_get_last_cpu(self):
        """SchedAssert.getLastCpu() gives you the last cpu in which a task ran"""
        expected_last_cpu = 5

        sa = SchedAssert("trace.dat", self.topology, execname="ls")
        self.assertEqual(sa.getLastCpu(), expected_last_cpu)