예제 #1
0
    def test_dpcp_and_sched(self):
        self.oheads(sched=True)
        self.no_reads()
        self.init_susp()
        self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
        self.unchanged_period()
        self.unchanged_deadline()
        self.not_lossy_no_reads()

        ecost = 17 + 19 + 2 * (27 + 31 + 41)
        xcost = 17 + 19 + 3 + 5 + 3 * (27 + 31)
        esusp = 2 * 23 + xcost

        self.assertEqual(self.ts[0].cost, 10000 + 6 * ecost)
        self.assertEqual(self.ts[1].cost,  5000 + 4 * ecost)

        self.assertEqual(self.ts[0].suspended, 6 * esusp)
        self.assertEqual(self.ts[1].suspended, 4 * esusp)

        self.assertEqual(self.ts[0].resmodel[0].max_read_length,   0)
        self.assertEqual(self.ts[0].resmodel[0].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[0].max_read_length,   0)
        self.assertEqual(self.ts[1].resmodel[0].max_write_length, 17 + xcost)

        self.assertEqual(self.ts[0].resmodel[1].max_read_length,  0)
        self.assertEqual(self.ts[0].resmodel[1].max_write_length,  11 + xcost)
        self.assertEqual(self.ts[1].resmodel[1].max_read_length,   0)
        self.assertEqual(self.ts[1].resmodel[1].max_write_length,   17 + xcost)

        self.assertEqual(self.ts[0].resmodel[2].max_read_length,   0)
        self.assertEqual(self.ts[0].resmodel[2].max_write_length,  11 + xcost)
        self.assertEqual(self.ts[1].resmodel[2].max_read_length,   0)
        self.assertEqual(self.ts[1].resmodel[2].max_write_length, 17 + xcost)
예제 #2
0
    def test_dpcp_and_sched(self):
        self.oheads(sched=True)
        self.no_reads()
        self.init_susp()
        self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
        self.unchanged_period()
        self.unchanged_deadline()
        self.not_lossy_no_reads()

        ecost = 17 + 19 + 2 * (27 + 31 + 41)
        xcost = 17 + 19 + 3 + 5 + 3 * (27 + 31)
        esusp = 2 * 23 + xcost

        self.assertEqual(self.ts[0].cost, 10000 + 6 * ecost)
        self.assertEqual(self.ts[1].cost, 5000 + 4 * ecost)

        self.assertEqual(self.ts[0].suspended, 6 * esusp)
        self.assertEqual(self.ts[1].suspended, 4 * esusp)

        self.assertEqual(self.ts[0].resmodel[0].max_read_length, 0)
        self.assertEqual(self.ts[0].resmodel[0].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[0].max_read_length, 0)
        self.assertEqual(self.ts[1].resmodel[0].max_write_length, 17 + xcost)

        self.assertEqual(self.ts[0].resmodel[1].max_read_length, 0)
        self.assertEqual(self.ts[0].resmodel[1].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[1].max_read_length, 0)
        self.assertEqual(self.ts[1].resmodel[1].max_write_length, 17 + xcost)

        self.assertEqual(self.ts[0].resmodel[2].max_read_length, 0)
        self.assertEqual(self.ts[0].resmodel[2].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[2].max_read_length, 0)
        self.assertEqual(self.ts[1].resmodel[2].max_write_length, 17 + xcost)
예제 #3
0
    def test_dpcp_lock_only(self):
        self.oheads()
        self.no_reads()
        self.init_susp()
        self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
        self.unchanged_period()
        self.unchanged_deadline()
        self.not_lossy_no_reads()

        ecost = 17 + 19
        xcost = 17 + 19 + 3 + 5
        esusp = 0 + xcost

        self.assertEqual(self.ts[0].cost, 10000 + 6 * ecost)
        self.assertEqual(self.ts[1].cost,  5000 + 4 * ecost)

        self.assertEqual(self.ts[0].suspended, 6 * esusp)
        self.assertEqual(self.ts[1].suspended, 4 * esusp)

        self.assertEqual(self.ts[0].resmodel[0].max_read_length,   0)
        self.assertEqual(self.ts[0].resmodel[0].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[0].max_read_length,   0)
        self.assertEqual(self.ts[1].resmodel[0].max_write_length, 17 + xcost)

        self.assertEqual(self.ts[0].resmodel[1].max_read_length,  0)
        self.assertEqual(self.ts[0].resmodel[1].max_write_length,  11 + xcost)
        self.assertEqual(self.ts[1].resmodel[1].max_read_length,   0)
        self.assertEqual(self.ts[1].resmodel[1].max_write_length,   17 + xcost)

        self.assertEqual(self.ts[0].resmodel[2].max_read_length,   0)
        self.assertEqual(self.ts[0].resmodel[2].max_write_length,  11 + xcost)
        self.assertEqual(self.ts[1].resmodel[2].max_read_length,   0)
        self.assertEqual(self.ts[1].resmodel[2].max_write_length, 17 + xcost)
예제 #4
0
 def test_dpcp_none(self):
     self.assertIs(locking.charge_dpcp_overheads(None, self.ts), self.ts)
     self.unchanged_period()
     self.unchanged_deadline()
     self.unchanged_cost()
     self.not_lossy()
     self.unchanged_resmodel()
예제 #5
0
    def test_dpcp_lock_only(self):
        self.oheads()
        self.no_reads()
        self.init_susp()
        self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
        self.unchanged_period()
        self.unchanged_deadline()
        self.not_lossy_no_reads()

        ecost = 17 + 19
        xcost = 17 + 19 + 3 + 5
        esusp = 0 + xcost

        self.assertEqual(self.ts[0].cost, 10000 + 6 * ecost)
        self.assertEqual(self.ts[1].cost, 5000 + 4 * ecost)

        self.assertEqual(self.ts[0].suspended, 6 * esusp)
        self.assertEqual(self.ts[1].suspended, 4 * esusp)

        self.assertEqual(self.ts[0].resmodel[0].max_read_length, 0)
        self.assertEqual(self.ts[0].resmodel[0].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[0].max_read_length, 0)
        self.assertEqual(self.ts[1].resmodel[0].max_write_length, 17 + xcost)

        self.assertEqual(self.ts[0].resmodel[1].max_read_length, 0)
        self.assertEqual(self.ts[0].resmodel[1].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[1].max_read_length, 0)
        self.assertEqual(self.ts[1].resmodel[1].max_write_length, 17 + xcost)

        self.assertEqual(self.ts[0].resmodel[2].max_read_length, 0)
        self.assertEqual(self.ts[0].resmodel[2].max_write_length, 11 + xcost)
        self.assertEqual(self.ts[1].resmodel[2].max_read_length, 0)
        self.assertEqual(self.ts[1].resmodel[2].max_write_length, 17 + xcost)
예제 #6
0
 def test_dpcp_none(self):
     self.assertIs(locking.charge_dpcp_overheads(None, self.ts), self.ts)
     self.unchanged_period()
     self.unchanged_deadline()
     self.unchanged_cost()
     self.not_lossy()
     self.unchanged_resmodel()
예제 #7
0
 def test_dpcp_zero(self):
     self.no_reads()
     self.init_susp()
     self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
     self.unchanged_period()
     self.unchanged_deadline()
     self.unchanged_cost()
     self.not_lossy_no_reads()
     self.unchanged_resmodel_no_reads()
예제 #8
0
 def test_dpcp_zero(self):
     self.no_reads()
     self.init_susp()
     self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
     self.unchanged_period()
     self.unchanged_deadline()
     self.unchanged_cost()
     self.not_lossy_no_reads()
     self.unchanged_resmodel_no_reads()
예제 #9
0
 def test_dpcp_integral(self):
     self.no_reads()
     self.init_susp()
     self.o.lock = const(1.75)
     self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
     self.assertEqual(self.ts[0].resmodel[0].max_write_length, 11 + 2)
예제 #10
0
 def test_dpcp_infeasible(self):
     self.no_reads()
     self.init_susp()
     self.o.syscall_in = const(10000000)
     self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), False)
예제 #11
0
 def test_dpcp_integral(self):
     self.no_reads()
     self.init_susp()
     self.o.lock = const(1.75)
     self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), self.ts)
     self.assertEqual(self.ts[0].resmodel[0].max_write_length, 11 + 2)
예제 #12
0
 def test_dpcp_infeasible(self):
     self.no_reads()
     self.init_susp()
     self.o.syscall_in = const(10000000)
     self.assertIs(locking.charge_dpcp_overheads(self.o, self.ts), False)