def yang(app): t_list = [] for ti in range(len(app.tasks)): response_time = app.tasks[ti].response_time() t_list.append(tasks.SporadicTask(response_time, response_time * 1000)) ts = tasks.TaskSystem(t_list) fp.bound_response_times(1, ts) resources.initialize_resource_model(ts) for ti in range(len(app.tasks)): for cs in app.tasks[ti].cs: ts[ti].resmodel[cs.resource].add_request(cs.duration) for t in ts: t.partition = 0 bounds.assign_fp_preemption_levels(ts) r_but = buttazzo(a) res = bounds.apply_pip_bounds(ts, 1) ret = {} for n in range(len(app.tasks) - 1): # the blocking time of last task is always 0 costH = 0 for h in range(n): costH += ts[h].cost y_Bn = res.get_blocking_term( n) - costH #cost of all the processes with higher priority if y_Bn > r_but[n][0]: feasible = False else: _, feasible, _ = schedule(app, app.tasks[n], r_but[n][1]) ret[n] = (y_Bn, feasible) return ret
def test_times3(self): self.assertTrue(fp.bound_response_times(3, self.ts)) self.assertEqual(self.ts[0].response_time, 1) self.assertEqual(self.ts[1].response_time, 1) self.assertEqual(self.ts[2].response_time, 3) self.assertEqual(self.ts[3].response_time, 12)
def test_times2(self): self.assertTrue(fp.bound_response_times(2, self.ts)) self.assertEqual(self.ts[0].response_time, 1) self.assertEqual(self.ts[1].response_time, 1) self.assertEqual(self.ts[2].response_time, 4) self.assertEqual(self.ts[3].response_time, 15)