示例#1
0
    def setUp(self):
        super(StrategyEvaluatorTestCase, self).setUp()
        scheduler = SchedulerFactory.getScheduler("FiFo", timeslice=10)
        scheduler.initialize("A")
        scheduler.run()

        self.evaluator = StrategyEvaluator()
示例#2
0
class StrategyEvaluatorComplexTestCase(FiFoScenario2):
    def setUp(self):
        super(StrategyEvaluatorComplexTestCase, self).setUp()
        scheduler = SchedulerFactory.getScheduler("FiFo", timeslice=10)
        scheduler.initialize("A")
        scheduler.run()

        self.evaluator = StrategyEvaluator()


    def test_getAverageCPUusage(self):
        cpu_usage = self.evaluator.getAverageCPUusage()
        self.assertEqual(cpu_usage, 1.0)

    def test_getPeriodDuration(self):
        periodDuration = self.evaluator.getPeriodDuration()
        self.assertEqual(periodDuration, 40)

    def test_getMeanResponseTime(self):
        meanRT = self.evaluator.getMeanResponseTime()
        self.assertEqual(meanRT, 7.5)
示例#3
0
class StrategyEvaluatorTestCase(SimpleFiFoScenario):
    def setUp(self):
        super(StrategyEvaluatorTestCase, self).setUp()
        scheduler = SchedulerFactory.getScheduler("FiFo", timeslice=10)
        scheduler.initialize("A")
        scheduler.run()

        self.evaluator = StrategyEvaluator()

    def test_averageCPUusage(self):
        expected = 30.0 / 35.0  # remeber: at least one value has to be a float!
        avg_usage = self.evaluator.getAverageCPUusage()
        self.assertEqual(avg_usage, expected)

    def test_PeriodDuration(self):
        duration = self.evaluator.getPeriodDuration()
        self.assertEqual(duration, 35)

    def test_getMeanResponseTime(self):
        # in this case, the mean response time is 0
        mean_r = self.evaluator.getMeanResponseTime()
        self.assertEqual(mean_r, 0.0)