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)
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)
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()
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()
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)
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)