def gensavetasksets(schedulers, n, nsets, u, min_p, max_p, outdir): # Manual configuration: configuration = Configuration() configuration.duration = 1000 * configuration.cycles_per_ms u = task_generator.StaffordRandFixedSum(n, u, nsets) periods = task_generator.gen_periods_uniform_ex(n, nsets, min_p, max_p, 10000000, True) # Add processors. for i in range(1, 5): configuration.add_processor(name="CPU " + str(i), identifier=i) if not os.path.exists(outdir): os.mkdir(outdir) for i, exp_set in enumerate(task_generator.gen_tasksets(u, periods)): for scheduler_name in schedulers: configuration.scheduler_info.clas = scheduler_name # print("{}:".format(scheduler_name)) while configuration.task_info_list: del configuration.task_info_list[0] id_ = 1 for (c, p) in exp_set: configuration.add_task(name="T{}".format(id_), identifier=id_, period=p, activation_date=0, wcet=c, deadline=p, abort_on_miss=True) id_ += 1 configuration.duration = configuration.get_hyperperiod( ) * configuration.cycles_per_ms # Vérification de la config. configuration.check_all() # save one taskset configuration.save(outdir + "/exp_{}.xml".format(i + 1))
def main(argv): schedulers = [ "schedulers/RM.py", "schedulers/EDF.py", "schedulers/PriD.py", "schedulers/EDF_US.py", "schedulers/EDZL.py", "schedulers/LLF.py", "schedulers/MLLF.py", "schedulers/P_EDF.py", "schedulers/LB_P_EDF.py", "schedulers/EDHS.py", "schedulers/EKG.py", "schedulers/LRE_TL.py", "schedulers/DP_WRAP.py", "schedulers/BF.py", "schedulers/LLREF.py", "schedulers/PD2.py", "schedulers/ER_PD2.py", "schedulers/RUN.py" ] schedulers = [ "schedulers/EDF.py", "schedulers/EDZL.py", "schedulers/MLLF.py", "schedulers/P_EDF.py", "schedulers/EDHS.py", "schedulers/EKG.py", "schedulers/LRE_TL.py", "schedulers/LLREF.py", "schedulers/ER_PD2.py", "schedulers/RUN.py" ] schedulers = ["schedulers/EDF.py", "schedulers/EDF2.py"] schedulers = [ "schedulers/WC_U_EDF.py", "schedulers/U_EDF.py", "schedulers/RUN.py", "schedulers/WC_RUN.py" ] schedulers = [ "schedulers/RUN.py", "schedulers/WC_RUN.py", "/home/max/Documents/These/RTCSA/experiments/schedulers/WC_RUN.py" ] schedulers = [ "schedulers/WC_U_EDF.py", "schedulers/U_EDF.py", "/home/max/Documents/These/RTCSA/experiments/schedulers/WC_U_EDF.py" ] schedulers = ["schedulers/PD2.py", "schedulers/ER_PD2.py"] output = input("Output directory: ") os.mkdir(output) wcet_file = open(output + "/wcet.csv", "w") csv_wcet = csv.writer(wcet_file) ResultExp.print_header(csv_wcet) acet_file = open(output + "/acet.csv", "w") csv_acet = csv.writer(acet_file) ResultExp.print_header(csv_acet) if argv: for i, f in enumerate(argv): configuration = Configuration(f) for scheduler_name in schedulers: print(scheduler_name) configuration.scheduler_info.set_name(scheduler_name, configuration.cur_dir) configuration.check_all() execute(configuration, "wcet", csv_wcet, wcet_file, i) execute(configuration, "acet", csv_acet, acet_file, i) else: # Manual configuration: configuration = Configuration() configuration.duration = 1000 * configuration.cycles_per_ms # Generate tasks: nsets = int(input("Number of experiments: ")) n = int(input("Number of tasks: ")) nb_proc = int(input("Number of processors: ")) u = float(input("Load: ")) u = task_generator.StaffordRandFixedSum(n, u, nsets) periods = task_generator.gen_periods_loguniform(n, nsets, 2, 100, round_to_int=True) # Add processors: for i in range(1, nb_proc + 1): configuration.add_processor(name="CPU {}".format(i), identifier=i) for i, exp_set in enumerate(task_generator.gen_tasksets(u, periods)): for scheduler_name in schedulers: print(scheduler_name) configuration.scheduler_info.set_name(scheduler_name, configuration.cur_dir) while configuration.task_info_list: del configuration.task_info_list[0] id_ = 1 for (c, p) in exp_set: configuration.add_task(name="T{}".format(id_), identifier=id_, period=p, activation_date=0, wcet=c, acet=c * .75, et_stddev=c * .1, deadline=p, abort_on_miss=True) id_ += 1 # Check the configuration: configuration.check_all() # Save the current exp: configuration.save(output + "/exp_{}.xml".format(i)) # Execute the simulation: execute(configuration, "wcet", csv_wcet, wcet_file, i) execute(configuration, "acet", csv_acet, acet_file, i)
def main(argv): print("usage: ./exp [filename1] [filename2] ...") # outdir = input("Output directory: ") outdir = "results" if not os.path.exists(outdir): os.mkdir(outdir) result_file = open(outdir + "/result.csv", "w") csv_result = csv.writer(result_file) ResultExp.print_header(csv_result) schedulers = [ "simso.schedulers.RM"] # "simso.schedulers.EDF", # "simso.schedulers.RM_mono"] if not argv: for i in range (1, 11): argv.append("tasksets/exp_{}.xml".format(str(i))) if argv: for i, f in enumerate(argv): configuration = Configuration(f) for scheduler_name in schedulers: configuration.scheduler_info.clas = scheduler_name # configuration.check_all() execute(configuration, "ofrp", csv_result, result_file, i+1) else: # Manual configuration: configuration = Configuration() configuration.duration = 1000 * configuration.cycles_per_ms # Generate tasks: nsets = int(input("Number of experiments: ")) n = int(input("Number of tasks: ")) nb_proc = int(input("Number of processors: ")) u = float(input("Load: ")) u = task_generator.StaffordRandFixedSum(n, u, nsets) periods = task_generator.gen_periods_loguniform(n, nsets, 2, 100, round_to_int=True) # Add processors: for i in range(1, nb_proc + 1): configuration.add_processor(name="CPU {}".format(i), identifier=i) for i, exp_set in enumerate(task_generator.gen_tasksets(u, periods)): for scheduler_name in schedulers: print(scheduler_name) configuration.scheduler_info.clas = scheduler_name while configuration.task_info_list: del configuration.task_info_list[0] id_ = 1 for (c, p) in exp_set: configuration.add_task( name="T{}".format(id_), identifier=id_, period=p, activation_date=0, wcet=c, acet=c * .75, et_stddev=c * .1, deadline=p, abort_on_miss=True) id_ += 1 configuration.duration = configuration.get_hyperperiod * configuration.cycles_per_ms # Check the configuration: configuration.check_all() # Save the current exp: configuration.save(outdir + "/exp_{}.xml".format(i+1)) # Execute the simulation: execute(configuration, "ofrp", csv_result, result_file, i+1)
def main(argv): if len(argv) == 1: configuration = Configuration(argv[0]) else: # Configuration manuelle : configuration = Configuration() configuration.duration = 20 * configuration.cycles_per_ms # Ajout des tâches. configuration.add_task(name="T1", identifier=1, period=4, activation_date=0, wcet=2, deadline=4) configuration.add_task(name="T2", identifier=2, period=5, activation_date=0, wcet=1, deadline=5) configuration.add_task(name="T3", identifier=3, period=20, activation_date=0, wcet=3, deadline=20) # Ajout d'un processeur. configuration.add_processor(name="CPU 1", identifier=1) configuration.add_processor(name="CPU 2", identifier=2) configuration.scheduler_info.clas = "simso.schedulers.RM" configuration.save("test.xml") # Vérification de la config. configuration.check_all() # Initialisation de la simu à partir de la config. model = Model(configuration) # Exécution de la simu. model.run_model() # Affichage des résultats. for log in model.logs: print(log) # Affichage de quelques métriques. # Durée d'exec des jobs print("Job computation times") for task in model.results.tasks: print(task.name + ":") for job in task.jobs: print("%s %.3f ms" % (job.name, job.computation_time)) # Nombre de préemptions par task print("Preemption counts:") for task in model.results.tasks.values(): print("%s %d" % (task.name, task.preemption_count)) cxt = 0 for processor in model.processors: prev = None for evt in processor.monitor: if evt[1].event == ProcEvent.RUN: if prev is not None and prev != evt[1].args.task: cxt += 1 prev = evt[1].args.task print("Number of context switches (without counting the OS): " + str(cxt))
def main(argv): schedulers = [ "schedulers/RM.py", "schedulers/EDF.py", "schedulers/PriD.py", "schedulers/EDF_US.py", "schedulers/EDZL.py", "schedulers/LLF.py", "schedulers/MLLF.py", "schedulers/P_EDF.py", "schedulers/LB_P_EDF.py", "schedulers/EDHS.py", "schedulers/EKG.py", "schedulers/LRE_TL.py", "schedulers/DP_WRAP.py", "schedulers/BF.py", "schedulers/LLREF.py", "schedulers/PD2.py", "schedulers/ER_PD2.py", "schedulers/RUN.py"] schedulers = [ "schedulers/EDF.py", "schedulers/EDZL.py", "schedulers/MLLF.py", "schedulers/P_EDF.py", "schedulers/EDHS.py", "schedulers/EKG.py", "schedulers/LRE_TL.py", "schedulers/LLREF.py", "schedulers/ER_PD2.py", "schedulers/RUN.py"] schedulers = ["schedulers/EDF.py", "schedulers/EDF2.py"] schedulers = ["schedulers/WC_U_EDF.py", "schedulers/U_EDF.py", "schedulers/RUN.py", "schedulers/WC_RUN.py"] schedulers = ["schedulers/RUN.py", "schedulers/WC_RUN.py", "/home/max/Documents/These/RTCSA/experiments/schedulers/WC_RUN.py"] schedulers = ["schedulers/WC_U_EDF.py", "schedulers/U_EDF.py", "/home/max/Documents/These/RTCSA/experiments/schedulers/WC_U_EDF.py"] schedulers = ["schedulers/PD2.py", "schedulers/ER_PD2.py"] output = input("Output directory: ") os.mkdir(output) wcet_file = open(output + "/wcet.csv", "w") csv_wcet = csv.writer(wcet_file) ResultExp.print_header(csv_wcet) acet_file = open(output + "/acet.csv", "w") csv_acet = csv.writer(acet_file) ResultExp.print_header(csv_acet) if argv: for i, f in enumerate(argv): configuration = Configuration(f) for scheduler_name in schedulers: print(scheduler_name) configuration.scheduler_info.set_name(scheduler_name, configuration.cur_dir) configuration.check_all() execute(configuration, "wcet", csv_wcet, wcet_file, i) execute(configuration, "acet", csv_acet, acet_file, i) else: # Manual configuration: configuration = Configuration() configuration.duration = 1000 * configuration.cycles_per_ms # Generate tasks: nsets = int(input("Number of experiments: ")) n = int(input("Number of tasks: ")) nb_proc = int(input("Number of processors: ")) u = float(input("Load: ")) u = task_generator.StaffordRandFixedSum(n, u, nsets) periods = task_generator.gen_periods_loguniform(n, nsets, 2, 100, round_to_int=True) # Add processors: for i in range(1, nb_proc + 1): configuration.add_processor(name="CPU {}".format(i), identifier=i) for i, exp_set in enumerate(task_generator.gen_tasksets(u, periods)): for scheduler_name in schedulers: print(scheduler_name) configuration.scheduler_info.set_name(scheduler_name, configuration.cur_dir) while configuration.task_info_list: del configuration.task_info_list[0] id_ = 1 for (c, p) in exp_set: configuration.add_task( name="T{}".format(id_), identifier=id_, period=p, activation_date=0, wcet=c, acet=c * .75, et_stddev=c * .1, deadline=p, abort_on_miss=True) id_ += 1 # Check the configuration: configuration.check_all() # Save the current exp: configuration.save(output + "/exp_{}.xml".format(i)) # Execute the simulation: execute(configuration, "wcet", csv_wcet, wcet_file, i) execute(configuration, "acet", csv_acet, acet_file, i)