def test_idx_calc(self): stat_param = { 'id': 0, 'min': 1.0, 'max': 2.1, } s = Stat(**stat_param) self.assertEqual(s.conv_idx(1.24), 2) self.assertEqual(s.conv_idx(1.25), 2)
'util_over': True, 'implicit_deadline': False, 'constrained_deadline': True, 'deadline_scale': 0.8, } u = Egen(**gen_param) print(u) # logger stat_param = { 'id': 0, 'min': 0.0, 'max': 4.0, 'inc': 0.1, } stat_single = Stat(**stat_param) stat_max = Stat(**stat_param) stat_random = Stat(**stat_param) stat_cho = Stat(**stat_param) notify_every = 1000 num_iter = 10000 # schedulability check param sched_param = { 'num_core': 4.0, } for i in range(num_iter): if i % notify_every == 0:
def test_proportion_calc(self): stat_param = { 'id': 0, 'min': 0.0, 'max': 2.1, } s = Stat(**stat_param) s.add(0.1, True) s.add(0.1, True) s.add(0.1, True) s.add(0.1, False) s.add(0.1, True) s.normalize() self.assertAlmostEqual(s.norm_data[s.conv_idx(0.1)], 0.8)
def parallel_assignment(self): """ Function : work for parallel assignment at background :return: No return """ # create generator gen_param = { 'num_task': 10, 'min_exec_time': 30, 'max_exec_time': 100, 'min_period': 60, 'max_period': 200, 'tot_util': 4.0, 'util_over': False, } u = Egen(**gen_param) print(u) print('--------') # logger stat_param = { 'id': 0, 'min': 0.0, 'max': 4.0, 'inc': 0.1, } stat_single = Stat(**stat_param) stat_max = Stat(**stat_param) stat_random = Stat(**stat_param) stat_cho = Stat(**stat_param) num_iter = 100000 notify_every = 10000 for i in range(num_iter): if i % notify_every == 0: print("{} % : {} / {}".format(i * 100 / num_iter, i, num_iter)) # generate tasks ts = u.next_task_set() if ts == -1: print("error") # schedulability check param sched_param = { 'num_core': 4.0, } # single thread pts_param_single = { 'base_ts': ts, 'max_option': 4, 'overhead': 0.1, 'variance': 0.8, 'popt_strategy': 'single', } pts = ParaTaskSet(**pts_param_single) pts_util = pts.tot_util() # single thread schedulability bcl_naive = BCLNaive(**sched_param) sched_single = bcl_naive.is_schedulable(pts) stat_single.add(pts_util, sched_single) stat_single.normalize() single_list = stat_single.norm_data # max thread pts.popt_strategy = 'max' pts.serialize_pts() # max thread schedulability sched_max = bcl_naive.is_schedulable(pts) stat_max.add(pts_util, sched_max) stat_max.normalize() max_list = stat_max.norm_data # random thread pts.popt_strategy = 'random' pts.serialize_pts() rnd_selected_option = pts.popt_list # random thread schedulability sched_random = bcl_naive.is_schedulable(pts) stat_random.add(pts_util, sched_random) stat_random.normalize() random_list = stat_random.norm_data # cho pts.popt_strategy = 'custom' pts.serialize_pts() # cho schedulability popt_param = { 'num_core': 4.0, 'max_option': 4, } cho = Cho(**popt_param) sched_cho = cho.is_schedulable(pts) stat_cho.add(pts_util, sched_cho) stat_cho.normalize() cho_list = stat_cho.norm_data if not sched_cho: if sched_single or sched_max or sched_random: print('!!something wrong') # print(pts) if sched_single: print('sched_single') if sched_max: print('sched_max') if sched_random: print('sched_random') print('rnd dbg:') print(rnd_selected_option) rnd_dbg = cho.is_schedulable_dbg(pts, rnd_selected_option) print(rnd_dbg) print('cho verbose result:') _, cho_selected_option = cho.is_schedulable_verbose(pts) print('cho dbg:') print(cho_selected_option) cho_dbg = cho.is_schedulable_dbg(pts, cho_selected_option) print(rnd_dbg) concat_data = { 'single': single_list, 'random': random_list, 'max': max_list, 'cho': cho_list} data_frame = pd.DataFrame(concat_data) self.sig_numbers.emit(data_frame, num_iter) time.sleep(0.1)
'min_exec_time': 2, 'max_exec_time': 7, 'min_period': 2, 'max_period': 7, 'tot_util': 2.0, } u = Unifast(**gen_param) # print(u) # print('--------') stat_param = { 'id': 0, 'min': 0.0, 'max': 4.0, 'inc': 0.1, } stat_gfb = Stat(**stat_param) stat_bcl = Stat(**stat_param) stat_bcl_mod = Stat(**stat_param) num_iter = 10000 for i in range(num_iter): # generate tasks ts = u.next_task_set() # print(ts) # test using various tests sched_param = { 'num_core': 2, } sched_bcl = bcl.is_schedulable(ts, **sched_param) sched_gfb = gfb.is_schedulable(ts, **sched_param)
'min_period': 60, 'max_period': 200, 'tot_util': 4.0, 'util_over': True, } u = Egen(**gen_param) print(u) # logger stat_param = { 'id': 0, 'min': 0.0, 'max': 4.0, 'inc': 0.1, } stat_single = Stat(**stat_param) stat_max = Stat(**stat_param) stat_random = Stat(**stat_param) stat_cho = Stat(**stat_param) n_sched_single = 0 n_sched_max = 0 n_sched_random = 0 n_sched_cho = 0 stat_single_bcl = Stat(**stat_param) stat_single_bar = Stat(**stat_param) stat_single_rta = Stat(**stat_param) n_sched_single_bcl = 0 n_sched_single_bar = 0 n_sched_single_rta = 0