Exemple #1
0
def main():

	remote = reciever("/tmp/ss_parser")

	configuration = Configuration()

	if remote == None:
		print "remote is none"
		#todo: this number should be generated randomly
		table = gen_slotshift_table(1, 10, 10, 10, .10)
		if table:
			remote = local_table(table[0], table[1],
				table[2], table[3])
		else:
			print "Cant Run because task set not generated"
			return
	else:
		remote.recieve_table()

	associate = association(remote)

	interval = associate.create_def_intr_list(associate)
	
	run_time = associate.get_running_time(interval)

	associate.create_relation_window(associate, interval)

	while 1:
		j = associate.create_tsk(associate, interval, configuration)
		if(j != 0):
			break

	configuration.duration = run_time * configuration.cycles_per_ms

	configuration.add_processor(name="CPU 1", identifier=1)

	configuration.scheduler_info.filename = "./SlotShifting.py"

	configuration.scheduler_info.data = interval

	configuration.check_all()

	model = Model(configuration)

	model.run_model()
Exemple #2
0
def main(argv):
    if len(argv) == 2:
        # Configuration load from a file.
        configuration = Configuration(argv[1])
    else:
        # Manual configuration:
        configuration = Configuration()

        configuration.duration = 420 * configuration.cycles_per_ms

        # Add tasks:
        configuration.add_task(name="T1", identifier=1, period=7,
                               activation_date=0, wcet=3, deadline=7)
        configuration.add_task(name="T2", identifier=2, period=12,
                               activation_date=0, wcet=3, deadline=12)
        configuration.add_task(name="T3", identifier=3, period=20,
                               activation_date=0, wcet=5, deadline=20)

        # Add a processor:
        configuration.add_processor(name="CPU 1", identifier=1)

        # Add a scheduler:
        #configuration.scheduler_info.filename = "../simso/schedulers/RM.py"
        configuration.scheduler_info.clas = "simso.schedulers.RM"

    # Check the config before trying to run it.
    configuration.check_all()

    # Init a model from the configuration.
    model = Model(configuration)

    # Execute the simulation.
    model.run_model()

    # Print logs.
    for log in model.logs:
        print(log)
Exemple #3
0
def main(argv):
    if len(argv) == 1:
        # Chargement de la conf depuis un fichier.
        configuration = Configuration(argv[0])
    else:
        # Configuration manuelle :
        configuration = Configuration()

        configuration.etm = "fixedpenalty"
        configuration.duration = 420 * configuration.cycles_per_ms

        # Ajout des tâches.
        configuration.add_task(name="T1", identifier=1, period=7,
                               activation_date=0, wcet=3, deadline=7)
        configuration.add_task(name="T2", identifier=2, period=12,
                               activation_date=0, wcet=3, deadline=12)
        configuration.add_task(name="T3", identifier=3, period=20,
                               activation_date=0, wcet=5, deadline=20)

        # Ajout d'un processeur.
        configuration.add_processor(name="CPU 1", identifier=1)

        configuration.scheduler_info.set_name("schedulers/RM.py")

    # 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)
Exemple #4
0
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)