Ejemplo n.º 1
0
    def setUpClass(cls):
        cls.params = {}
        cls.env = TestEnv(test_conf=TEST_CONF)
        cls.trace_file = os.path.join(cls.env.res_dir, "offload_idle_pull.dat")
        cls.log_file = os.path.join(cls.env.res_dir, "offload_idle_pull.json")
        cls.early_starters = []
        cls.migrators = []
        cls.num_tasks = len(cls.env.target.bl.bigs)
        cls.populate_tasks()
        local_setup(cls.env)
        cls.run_workload()

        cls.trace = trappy.FTrace(cls.trace_file)
        cls.m_assert = SchedMultiAssert(cls.trace,
                                        cls.env.topology,
                                        execnames=cls.migrators)
        cls.e_assert = SchedMultiAssert(cls.trace,
                                        cls.env.topology,
                                        execnames=cls.early_starters)

        all_tasks = cls.early_starters + cls.migrators
        cls.a_assert = SchedMultiAssert(cls.trace,
                                        cls.env.topology,
                                        execnames=all_tasks)
        cls.offset = cls.get_offset()

        cls.end_times = cls.calculate_end_times()
        cls.log_fh = open(os.path.join(cls.env.res_dir, cls.log_file), "w")
    def test_cpu_busy_time(self):
        """SchedMultiAssert.getCPUBusyTime() work"""

        # precalculated values against these processes in the trace
        pids = [4729, 4734]
        first_time = .000214
        last_time = .003171

        tr = trappy.FTrace()
        sma = SchedMultiAssert(tr, self.topology, pids=pids)

        expected_busy_time = 0.0041839999754810708
        busy_time = sma.getCPUBusyTime("all",
                                       self.all_cpus,
                                       window=(first_time, last_time))
        self.assertAlmostEqual(busy_time, expected_busy_time)

        # percent calculation
        expected_busy_pct = 23.582459561949445
        busy_pct = sma.getCPUBusyTime("all",
                                      self.all_cpus,
                                      percent=True,
                                      window=(first_time, last_time))
        self.assertAlmostEqual(busy_pct, expected_busy_pct)

        # percent without a window
        expected_busy_pct = 23.018818156540004
        busy_pct = sma.getCPUBusyTime("cluster", self.little, percent=True)
        self.assertAlmostEqual(busy_pct, expected_busy_pct)
Ejemplo n.º 3
0
    def test_cpu_busy_time(self):
        """SchedMultiAssert.getCPUBusyTime() work"""

        # precalculated values against these processes in the trace
        pids = [4729, 4734]
        first_time = .000214
        last_time = .003171

        tr = trappy.FTrace()
        sma = SchedMultiAssert(tr, self.topology, pids=pids)

        expected_busy_time = 0.0041839999754810708
        busy_time = sma.getCPUBusyTime("all", self.all_cpus, window=(first_time, last_time))
        self.assertAlmostEqual(busy_time, expected_busy_time)

        # percent calculation
        expected_busy_pct = 23.582459561949445
        busy_pct= sma.getCPUBusyTime("all", self.all_cpus, percent=True,
                                     window=(first_time, last_time))
        self.assertAlmostEqual(busy_pct, expected_busy_pct)

        # percent without a window
        expected_busy_pct = 23.018818156540004
        busy_pct= sma.getCPUBusyTime("cluster", self.little, percent=True)
        self.assertAlmostEqual(busy_pct, expected_busy_pct)
Ejemplo n.º 4
0
    def test_first_cpu(self):
        "Fork Migration: Test First CPU"

        logging.info("Fork Migration: Test First CPU")
        f_assert = SchedMultiAssert(self.trace_file,
                                    self.env.topology,
                                    execnames=self.tasks)

        log_result(f_assert.getFirstCpu(), self.log_fh)

        self.assertTrue(
            f_assert.assertFirstCpu(self.env.target.bl.bigs,
                                    rank=self.num_tasks),
            msg="Not all the new generated tasks started on a big CPU")
Ejemplo n.º 5
0
    def test_first_cpu(self):
        "Fork Migration: Test First CPU"

        logging.info("Fork Migration: Test First CPU")
        f_assert = SchedMultiAssert(
            self.trace_file,
            self.env.topology,
            execnames=self.tasks)

        log_result(
            f_assert.getFirstCpu(), self.log_fh)

        self.assertTrue(
            f_assert.assertFirstCpu(
                self.env.target.bl.bigs,
                rank=self.num_tasks),
            msg="Not all the new generated tasks started on a big CPU")
Ejemplo n.º 6
0
    def get_multi_assert(self, experiment, task_filter=""):
        """
        Return a SchedMultiAssert over the tasks whose names contain task_filter

        By default, this includes _all_ the tasks that were executed for the
        experiment.
        """
        tasks = experiment.wload.tasks.keys()
        return SchedMultiAssert(
            self.get_trace(experiment).ftrace, self.te.topology,
            [t for t in tasks if task_filter in t])
Ejemplo n.º 7
0
    def setUpClass(cls):
        cls.params = {}
        cls.env = TestEnv(test_conf=TEST_CONF)
        cls.trace_file = os.path.join(cls.env.res_dir, "cap_cap.dat")
        cls.populate_params()

        cls.run_workload()

        trace = trappy.FTrace(cls.trace_file)
        cls.sa = SchedMultiAssert(trace,
                                  cls.env.topology,
                                  execnames=cls.params.keys())
Ejemplo n.º 8
0
    def setUpClass(cls):
        cls.params = {}
        cls.env = TestEnv(test_conf=TEST_CONF)
        cls.trace_file = os.path.join(cls.env.res_dir, "cap_cap.dat")
        cls.populate_params()

        cls.run_workload()

        trace = trappy.FTrace(cls.trace_file)
        cls.sa = SchedMultiAssert(trace, cls.env.topology,
                                  execnames=cls.params.keys())
        times = cls.sa.getStartTime()
        cls.wload_start_time = min(t["starttime"] for t in times.itervalues())
Ejemplo n.º 9
0
 def setUpClass(cls):
     cls.params = {}
     cls.env = TestEnv(test_conf=TEST_CONF)
     cls.task_prefix = "wmig"
     cls.trace_file = os.path.join(cls.env.res_dir, "wake_migration.dat")
     cls.log_file = os.path.join(cls.env.res_dir, "wake_migration.json")
     cls.populate_params()
     cls.tasks = cls.params.keys()
     cls.num_tasks = len(cls.tasks)
     local_setup(cls.env)
     cls.run_workload()
     cls.s_assert = SchedMultiAssert(cls.trace_file,
                                     cls.env.topology,
                                     execnames=cls.tasks)
     cls.offset = cls.get_offset(cls.tasks[0])
     cls.log_fh = open(os.path.join(cls.env.res_dir, cls.log_file), "w")
Ejemplo n.º 10
0
 def setUpClass(cls):
     cls.params = {}
     cls.task_prefix = "stp"
     cls.env = TestEnv(test_conf=TEST_CONF)
     cls.trace_file = os.path.join(cls.env.res_dir,
                                   "small_task_packing.dat")
     cls.log_file = os.path.join(cls.env.res_dir, "small_task_packing.json")
     cls.num_tasks = len(cls.env.target.bl.bigs + cls.env.target.bl.littles)
     cls.populate_params()
     cls.tasks = cls.params.keys()
     local_setup(cls.env)
     cls.run_workload()
     cls.s_assert = SchedMultiAssert(cls.trace_file,
                                     cls.env.topology,
                                     execnames=cls.tasks)
     cls.log_fh = open(os.path.join(cls.env.res_dir, cls.log_file), "w")