def gen_taskset(periods, period_distribution, tasks_n, utilization, period_granularity=None, scale=ms2us, want_integral=True): if periods in NAMED_PERIODS: # Look up by name. (period_min, period_max) = NAMED_PERIODS[periods] else: # If unknown, then assume caller specified range manually. (period_min, period_max) = periods x = StaffordRandFixedSum(tasks_n, utilization, 1) if period_granularity is None: period_granularity = period_min periods = gen_periods(tasks_n, 1, period_min, period_max, period_granularity, period_distribution) ts = TaskSystem() periods = numpy.maximum(periods[0], max(period_min, period_granularity)) C = scale(x[0] * periods) taskset = numpy.c_[x[0], C / periods, periods, C] for t in range(numpy.size(taskset,0)): ts.append(SporadicTask(taskset[t][3], scale(taskset[t][2]))) if want_integral: quantize_params(ts) return ts
def bound_cfl_with_oh(oheads, dedicated_irq, clusts): for clust in clusts: success = charge_scheduling_overheads(oheads, clust.cpus, dedicated_irq, clust) quantize_params(clust) if (success and has_bounded_tardiness(clust.cpus, clust)): bound_gfl_response_times(clust.cpus, clust, 15) else: return False return True
def post_blocking_term_oh_inflation(oheads, clusts): for clust in clusts: inflation = oheads.syscall_in(len(clust)) for t in clust: if t.arrival_blocked: t.cost += inflation t.arrival_blocked += inflation if not charge_scheduling_overheads(oheads, clust.cpus, True, clust): return False quantize_params(clust) return True
def test_cache_affinity_loss(self): self.o.cache_affinity_loss = const(1) self.assertEqual(jlfp.charge_scheduling_overheads(self.o, 4, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10001) self.assertEqual(self.ts[1].cost, 5001) self.unchanged_period() self.unchanged_deadline()
def test_initial_load(self): self.o.initial_cache_load = const(4) self.assertEqual(jlfp.charge_initial_load(self.o, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10004) self.assertEqual(self.ts[1].cost, 5004) self.unchanged_period() self.unchanged_deadline()
def test_release(self): self.o.release = const(1) self.assertEqual(jlfp.charge_scheduling_overheads(self.o, 4, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10005) self.assertEqual(self.ts[1].cost, 5005) self.unchanged_period() self.unchanged_deadline()
def test_release_latency(self): self.o.release_latency = const(1) self.assertEqual(jlfp.charge_scheduling_overheads(self.o, 4, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.unchanged_cost() self.assertEqual(self.ts[0].period, 99999) self.assertEqual(self.ts[1].period, 49999) self.assertEqual(self.ts[0].deadline, 99999) self.assertEqual(self.ts[1].deadline, 49999)
def test_cache_affinity_loss(self): self.o.cache_affinity_loss = const(1) self.assertEqual( jlfp.charge_scheduling_overheads(self.o, 4, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10001) self.assertEqual(self.ts[1].cost, 5001) self.unchanged_period() self.unchanged_deadline()
def test_release(self): self.o.release = const(1) self.assertEqual( jlfp.charge_scheduling_overheads(self.o, 4, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10005) self.assertEqual(self.ts[1].cost, 5005) self.unchanged_period() self.unchanged_deadline()
def test_release_latency(self): self.o.release_latency = const(1) self.assertEqual( jlfp.charge_scheduling_overheads(self.o, 4, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.unchanged_cost() self.assertEqual(self.ts[0].period, 99999) self.assertEqual(self.ts[1].period, 49999) self.assertEqual(self.ts[0].deadline, 99999) self.assertEqual(self.ts[1].deadline, 49999)
def test_tick_example(self): e1 = 2000 e2 = 3000 Q = 5000 tck = 2000 self.ts[0].cost = e1 self.ts[1].cost = e2 self.o.tick = const(tck) self.o.quantum_length = Q self.assertEqual(jlfp.charge_scheduling_overheads(self.o, 1, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, int(ceil(30000 / 3))) self.assertEqual(self.ts[1].cost, 5000 + int(ceil(20000 / 3)))
def test_tick_example(self): e1 = 2000 e2 = 3000 Q = 5000 tck = 2000 self.ts[0].cost = e1 self.ts[1].cost = e2 self.o.tick = const(tck) self.o.quantum_length = Q self.assertEqual( jlfp.charge_scheduling_overheads(self.o, 1, False, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, int(ceil(30000 / 3))) self.assertEqual(self.ts[1].cost, 5000 + int(ceil(20000 / 3)))
def test_dedicated(self): self.o.ipi_latency = const(100) self.assertEqual(jlfp.charge_scheduling_overheads(self.o, 4, True, self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10100) self.assertEqual(self.ts[1].cost, 5100) self.unchanged_period() self.unchanged_deadline() self.o.release = const(133) self.assertEqual(jlfp.charge_scheduling_overheads(self.o, 4, True, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10333) self.assertEqual(self.ts[1].cost, 5333) self.unchanged_period() self.unchanged_deadline()
def test_dedicated(self): self.o.ipi_latency = const(100) self.assertEqual( jlfp.charge_scheduling_overheads(self.o, 4, True, self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10100) self.assertEqual(self.ts[1].cost, 5100) self.unchanged_period() self.unchanged_deadline() self.o.release = const(133) self.assertEqual( jlfp.charge_scheduling_overheads(self.o, 4, True, self.ts), self.ts) self.assertEqual(jlfp.quantize_params(self.ts), self.ts) self.assertEqual(self.ts[0].cost, 10333) self.assertEqual(self.ts[1].cost, 5333) self.unchanged_period() self.unchanged_deadline()