diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 364468893f53325d971929dfd60ac4586793d25f..38c261c3b2bd237be0136830af4140dec6a65ad7 100644 --- a/tests/eas/rfc.py +++ b/tests/eas/rfc.py @@ -15,12 +15,14 @@ # limitations under the License. # +from bart.common.Analyzer import Analyzer import collections import datetime import json import os import re import time +import trappy # Configure logging import logging @@ -110,9 +112,7 @@ class TestBase(unittest.TestCase): def test_execution_complete(self): """Check that data have been collected from the target""" - logging.info(r'Check for data being collected') - return True - + # TODO ################################################################################ # Utility methods @@ -562,6 +562,52 @@ class STune(TestBase): def setUpClass(cls): super(STune, cls).setUpTest('rfc_stune.config') + def test_boosted_utilization_signal(self): + """The boosted utilization signal is appropriately boosted + + The margin should match the formula + (sched_load_scale - utilization) * boost""" + + for tc in self.conf["confs"]: + test_id = tc["tag"] + + wload_idx = self.conf["wloads"].keys()[0] + run_dir = os.path.join(self.env.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] + + # 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 + boost_task_rtapp = boost_task_rtapp.ix[after_first_period:] + + sched_load_scale = 1024 + boost = tc["cgroups"]["conf"]["schedtune"]["/stune"]["boost"] / 100. + utilization = boost_task_rtapp["utilization"] + expected_margin = (sched_load_scale - utilization) * boost + expected_margin = expected_margin.astype(int) + boost_task_rtapp["expected_margin"] = expected_margin + ftrace.add_parsed_event("boost_task_rtapp", boost_task_rtapp) + + analyzer = Analyzer(ftrace, {}) + statement = "boost_task_rtapp:margin == boost_task_rtapp:expected_margin" + error_msg = "task was not boosted to the expected margin: {}".\ + format(boost) + self.assertTrue(analyzer.assertStatement(statement), msg=error_msg) + ################################################################################ # Globals