Beispiel #1
0
    def test_assert_statement_dataframe(self):
        """assertStatement() works if the generated statement creates a pandas.DataFrame of bools"""

        rolls_dfr = pd.DataFrame({"results": [1, 3, 2, 6, 2, 4]})
        trace = trappy.BareTrace()
        trace.add_parsed_event("dice_rolls", rolls_dfr)
        config = {"MIN_DICE_NUMBER": 1, "MAX_DICE_NUMBER": 6}
        t = Analyzer(trace, config)

        statement = "(dice_rolls:results <= MAX_DICE_NUMBER) & (dice_rolls:results >= MIN_DICE_NUMBER)"
        self.assertTrue(t.assertStatement(statement))

        statement = "dice_rolls:results == 3"
        self.assertFalse(t.assertStatement(statement))
Beispiel #2
0
    def test_assert_statement_dataframe(self):
        """assertStatement() works if the generated statement creates a pandas.DataFrame of bools"""

        rolls_dfr = pd.DataFrame({"results": [1, 3, 2, 6, 2, 4]})
        trace = trappy.BareTrace()
        trace.add_parsed_event("dice_rolls", rolls_dfr)
        config = {"MIN_DICE_NUMBER": 1, "MAX_DICE_NUMBER": 6}
        t = Analyzer(trace, config)

        statement = "(dice_rolls:results <= MAX_DICE_NUMBER) & (dice_rolls:results >= MIN_DICE_NUMBER)"
        self.assertTrue(t.assertStatement(statement))

        statement = "dice_rolls:results == 3"
        self.assertFalse(t.assertStatement(statement))
Beispiel #3
0
    def test_assert_statement_bool(self):
        """Check that asssertStatement() works with a simple boolean case"""

        rolls_dfr = pd.DataFrame({"results": [1, 3, 2, 6, 2, 4]})
        trace = trappy.BareTrace()
        trace.add_parsed_event("dice_rolls", rolls_dfr)
        config = {"MAX_DICE_NUMBER": 6}

        t = Analyzer(trace, config)
        statement = "numpy.max(dice_rolls:results) <= MAX_DICE_NUMBER"
        self.assertTrue(t.assertStatement(statement, select=0))
Beispiel #4
0
    def test_assert_statement_bool(self):
        """Check that asssertStatement() works with a simple boolean case"""

        rolls_dfr = pd.DataFrame({"results": [1, 3, 2, 6, 2, 4]})
        trace = trappy.BareTrace()
        trace.add_parsed_event("dice_rolls", rolls_dfr)
        config = {"MAX_DICE_NUMBER": 6}

        t = Analyzer(trace, config)
        statement = "numpy.max(dice_rolls:results) <= MAX_DICE_NUMBER"
        self.assertTrue(t.assertStatement(statement, select=0))
Beispiel #5
0
    def test_boosted_utilization_signal(self):
        """The boosted utilization signal is appropriately boosted

        The margin should match the formula
        (sched_load_scale - util) * boost"""

        for tc in self.conf["confs"]:
            test_id = tc["tag"]

            wload_idx = self.conf["wloads"].keys()[0]
            run_dir = os.path.join(self.te.res_dir,
                                   "rtapp:{}:{}".format(test_id,
                                                        wload_idx), "1")

            ftrace_events = ["sched_boost_task"]
            ftrace = trappy.FTrace(run_dir,
                                   scope="custom",
                                   events=ftrace_events)

            first_task_params = self.conf["wloads"][wload_idx]["conf"][
                "params"]
            first_task_name = first_task_params.keys()[0]
            rta_task_name = "task_{}".format(first_task_name)

            sbt_dfr = ftrace.sched_boost_task.data_frame
            boost_task_rtapp = sbt_dfr[sbt_dfr.comm == rta_task_name]
            ftrace.add_parsed_event("boost_task_rtapp", boost_task_rtapp)

            # Avoid the first period as the task starts with a very
            # high load and it overutilizes the CPU
            rtapp_period = first_task_params[first_task_name]["params"][
                "period_ms"]
            task_start = boost_task_rtapp.index[0]
            after_first_period = task_start + (rtapp_period / 1000.)

            boost = tc["cgroups"]["conf"]["schedtune"]["/stune"]["boost"] / 100.
            analyzer_const = {
                "SCHED_LOAD_SCALE": 1024,
                "BOOST": boost,
            }
            analyzer = Analyzer(ftrace,
                                analyzer_const,
                                window=(after_first_period, None))
            statement = "(((SCHED_LOAD_SCALE - boost_task_rtapp:util) * BOOST) // 100) == boost_task_rtapp:margin"
            error_msg = "task was not boosted to the expected margin: {}".\
                        format(boost)
            self.assertTrue(analyzer.assertStatement(statement), msg=error_msg)
Beispiel #6
0
    def test_boosted_utilization_signal(self):
        """Tasks in stune groups are boosted"""

        for tc in self.confs:
            conf_id = tc["tag"]

            wload_id = self.wloads.keys()[0]
            run_dir = os.path.join(self.te.res_dir,
                                   "rtapp:{}:{}".format(conf_id,
                                                        wload_id), "1")

            ftrace_events = ["sched_boost_task"]
            ftrace = trappy.FTrace(run_dir,
                                   scope="custom",
                                   events=ftrace_events)

            first_task_params = self.wloads[wload_id]["conf"]["params"]
            first_task_name = first_task_params.keys()[0]
            rta_task_name = "task_{}".format(first_task_name)

            # Avoid the first period as the task starts with a very
            # high load and it overutilizes the CPU
            rtapp_period = first_task_params[first_task_name]["params"][
                "period_ms"]
            sbt_dfr = ftrace.sched_boost_task.data_frame
            task_start = sbt_dfr[sbt_dfr.comm == rta_task_name].index[0]
            after_first_period = task_start + (rtapp_period / 1000.)

            boost = tc["cgroups"]["conf"]["schedtune"]["/stune"]["boost"]
            analyzer_const = {
                "SCHED_LOAD_SCALE": 1024,
                "BOOST": boost,
            }
            analyzer = Analyzer(ftrace,
                                analyzer_const,
                                window=(after_first_period, None),
                                filters={"comm": rta_task_name})
            if boost == 0:
                statement = "sched_boost_task:margin == 0"
            elif boost > 0:
                statement = "(((SCHED_LOAD_SCALE - sched_boost_task:util) * BOOST) // 100) == sched_boost_task:margin"
            else:
                statement = "-((-sched_boost_task:util * BOOST) // 100) == sched_boost_task:margin"

            error_msg = "task was not boosted to the expected margin: {:.2f}"\
                        .format(boost / 100.)
            self.assertTrue(analyzer.assertStatement(statement), msg=error_msg)
Beispiel #7
0
    def test_boosted_utilization_signal(self):
        """Tasks in stune groups are boosted"""

        for tc in self.confs:
            conf_id = tc["tag"]

            wload_id = self.wloads.keys()[0]
            run_dir = os.path.join(self.te.res_dir,
                                   "rtapp:{}:{}".format(conf_id, wload_id),
                                   "1")

            ftrace_events = ["sched_boost_task"]
            ftrace = trappy.FTrace(run_dir, scope="custom",
                                   events=ftrace_events)

            first_task_params = self.wloads[wload_id]["conf"]["params"]
            first_task_name = first_task_params.keys()[0]
            rta_task_name = "task_{}".format(first_task_name)

            # Avoid the first period as the task starts with a very
            # high load and it overutilizes the CPU
            rtapp_period = first_task_params[first_task_name]["params"]["period_ms"]
            sbt_dfr = ftrace.sched_boost_task.data_frame
            task_start = sbt_dfr[sbt_dfr.comm == rta_task_name].index[0]
            after_first_period = task_start + (rtapp_period / 1000.)

            boost = tc["cgroups"]["conf"]["schedtune"]["/stune"]["boost"]
            analyzer_const = {
                "SCHED_LOAD_SCALE": 1024,
                "BOOST": boost,
            }
            analyzer = Analyzer(ftrace, analyzer_const,
                                window=(after_first_period, None),
                                filters={"comm": rta_task_name})
            if boost == 0:
                statement = "sched_boost_task:margin == 0"
            elif boost > 0:
                statement = "(((SCHED_LOAD_SCALE - sched_boost_task:util) * BOOST) // 100) == sched_boost_task:margin"
            else:
                statement = "-((-sched_boost_task:util * BOOST) // 100) == sched_boost_task:margin"

            error_msg = "task was not boosted to the expected margin: {:.2f}"\
                        .format(boost / 100.)
            self.assertTrue(analyzer.assertStatement(statement), msg=error_msg)
Beispiel #8
0
    def test_boosted_utilization_signal(self):
        """The boosted utilization signal is appropriately boosted

        The margin should match the formula
        (sched_load_scale - util) * boost"""

        for tc in self.conf["confs"]:
            test_id = tc["tag"]

            wload_idx = self.conf["wloads"].keys()[0]
            run_dir = os.path.join(self.te.res_dir,
                                   "rtapp:{}:{}".format(test_id, wload_idx),
                                   "1")

            ftrace_events = ["sched_boost_task"]
            ftrace = trappy.FTrace(run_dir, scope="custom",
                                   events=ftrace_events)

            first_task_params = self.conf["wloads"][wload_idx]["conf"]["params"]
            first_task_name = first_task_params.keys()[0]
            rta_task_name = "task_{}".format(first_task_name)

            sbt_dfr = ftrace.sched_boost_task.data_frame
            boost_task_rtapp = sbt_dfr[sbt_dfr.comm == rta_task_name]
            ftrace.add_parsed_event("boost_task_rtapp", boost_task_rtapp)

            # Avoid the first period as the task starts with a very
            # high load and it overutilizes the CPU
            rtapp_period = first_task_params[first_task_name]["params"]["period_ms"]
            task_start = boost_task_rtapp.index[0]
            after_first_period = task_start + (rtapp_period / 1000.)

            boost = tc["cgroups"]["conf"]["schedtune"]["/stune"]["boost"] / 100.
            analyzer_const = {
                "SCHED_LOAD_SCALE": 1024,
                "BOOST": boost,
            }
            analyzer = Analyzer(ftrace, analyzer_const,
                                window=(after_first_period, None))
            statement = "(((SCHED_LOAD_SCALE - boost_task_rtapp:util) * BOOST) // 100) == boost_task_rtapp:margin"
            error_msg = "task was not boosted to the expected margin: {}".\
                        format(boost)
            self.assertTrue(analyzer.assertStatement(statement), msg=error_msg)