def run(): # Init js.globals["python"]["sim-success"] = False errorLogger = js.globals["python"]["logSchedulerError"] eventLogger = js.globals["python"]["logSchedulerEvent"] # Runs the model try: configuration.check_all() print("Configuration OK") model = Model(configuration) model.run_model() print("Successfully run simulation") except Exception, err: exc_type, exc_value, exc_traceback = sys.exc_info() error = traceback.format_exception_only(exc_type, exc_value)[0] tb = traceback.extract_tb(exc_traceback) # Puts the error into the error logger. errorLogger({'type': 'errorCode', 'value': error}) for tb_line in tb: filename, line, inn, code = tb_line errorLogger({ 'type': 'stack', 'value': " File \"" + filename + "\", line " + str(line) + ", in " + inn, 'code': code }) # errorLogger(str(traceback.format_exc())) return
class SimSoSession(AbstractSession): def __init__(self, host, port): self.logger = logging.getLogger("SimSoSession") # choose a configuration self.configuration = Configuration() # set processsors self.configuration.add_processor(name="CPU 1", identifier=1) def start(self, taskset, scheduler_class = "simso.schedulers.RM"): # add tasks to simso for task in taskset: self.configuration.add_task( name = 'task_'+str(task['id']), identifier = task['id'], period = task['period'], activation_date = 0, wcet = 3, # ! deadline = 20 ) self.configuration.scheduler_info.clas = scheduler_class self.configuration.check_all() self.model = Model(self.configuration) def is_available(host): return True def is_running(self, taskset): # this method is called after the first `run`. So we are already done. return False def stop(self): pass def run(self, taskset): # run the model self.model.run_model() # update taskset for task in self.model.results.tasks: _task = self._get_task_by_id(taskset, task.identifier) for job in task.jobs: _job = Job() _job.start_date = job.activation_date _job.end_date = job.end_date _task.jobs.append(_job) def close(self): pass def _get_task_by_id(self, taskset, task_id): # the taskset is a list, we have to loop over all items... for task in taskset: if task.id == task_id: return task return None
def run(self): """ Runs the experiment and computes the metrics. """ self.results = [] all_results = [] for configuration in self.conf_files: model = Model(configuration) model.run_model() self.results.append(model.results) all_results.append(MetricsCollector(model.results)) self.metrics = {} # sum, avg, std, med, min, max metric_keys = [key for key in all_results[0].metrics] for key in metric_keys: values = [res.metrics[key] for res in all_results] self.metrics[key] = [ sum(values), numpy.average(values), numpy.std(values), numpy.median(values), min(values), max(values) ]
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)
def run(): # Init js.globals["python"]["sim-success"] = False errorLogger = js.globals["python"]["logSchedulerError"]; eventLogger = js.globals["python"]["logSchedulerEvent"]; # Runs the model try: configuration.check_all() print("Configuration OK") model = Model(configuration) model.run_model() print("Successfully run simulation") except Exception, err: exc_type, exc_value, exc_traceback = sys.exc_info() error = traceback.format_exception_only(exc_type, exc_value)[0] tb = traceback.extract_tb(exc_traceback) # Puts the error into the error logger. errorLogger({ 'type' : 'errorCode', 'value' : error }) for tb_line in tb: filename, line, inn, code = tb_line errorLogger({ 'type': 'stack', 'value' : " File \"" + filename + "\", line " + str(line) + ", in " + inn, 'code' : code }) # errorLogger(str(traceback.format_exc())) return
def execute(configuration, etm, csv, csv_file, exp_id): scheduler_name = configuration.scheduler_info.name configuration.etm = etm model = Model(configuration) try: model.run_model() r = ResultExp(scheduler_name, exp_id, model.results) r.save(csv) csv_file.flush() except AssertionError as e: print(e)
def run_model(config): model = Model(config) # Execute the simulation. model.run_model() # Print logs. if DEBUG: print("Logs ") for log in model.logs: print(log) return model.results
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=np.array([[1, 2, 3], [.1, .2, .7]]), deadline=7) # add a task with a probabilistic WCET 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)
def run_sim(params: dict) -> dict: """ Run the simulation of a rts. :param rts: rts to simulate. :param params: simulation parameters. :param callback: callback to be called from simso. :return: a dict with the simulation results """ result = { "error": False, } try: if params["rts"]["schedulable"]: # Create SimSo configuration and model. cfg = create_configuration(params["rts"], params["ss_methods"], params["instance_count"]) # Creates a SimSo model from the provided SimSo configuration. model = Model(cfg) # Add the slack methods to evaluate. model.scheduler.data["slack_methods"] = params["ss_methods"] # Number of instances to record. model.scheduler.data["instance_count"] = params["instance_count"] # Discard trace information to reduce memory footprint if not params["gantt"]: model._logger = SinkLogger(model) for task in model.scheduler.task_list: task._monitor = SinkMonitor() for cpu in model.scheduler.processors: cpu.monitor = SinkMonitor() # Run the simulation. model.run_model() except (NegativeSlackException, DifferentSlackException) as exc: result["error"] = True result["error_msg"] = str(exc) except KeyError as exc: result["error"] = True result["error_msg"] = "Slack Method not found: {0}.".format(str(exc)) finally: if params["gantt"]: result["model"] = model return result
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()
def main(args): # Load configuration file and check configPath = args.configPaths[args.currentConfigIdx] configuration = Configuration(configPath) configuration.check_all() # Init a model from the configuration. model = Model(configuration) # Execute the simulation. model.run_model() # Write results to csv file logger.log(15,"Total Migrations: " + str(model.results.total_migrations)) logger.log(15,"Total Pre-emptions: " + str(model.results.total_preemptions)) logger.log(15,"Total Exceeded Count: " + str(model.results.total_exceeded_count)) logger.log(15,"Fitness Score: " + str(Fitness.getFitnessScoreStatic( model.results.total_exceeded_count, model.results.total_preemptions, model.results.total_migrations))) Results.outputDefResults(args,model)
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)
def main(argv): global procCount if len(argv) == 8: # Configuration load from a file. nrOfRuns = int(argv[1]) nrOfProc = int(argv[2]) minNrOfPeriodicTasks = int(argv[3]) maxNrOfPeriodicTasks = int(argv[4]) minNrOfSporadicTasks = int(argv[5]) maxNrOfSporadicTasks = int(argv[6]) tasksFileName = argv[7] else: raise Exception("Configuration is not correct.") schedulingAlgos = [ 'simso.schedulers.EDCL', 'simso.schedulers.EDF', # 'simso.schedulers.EDF_US', 'simso.schedulers.EDHS', # 'simso.schedulers.EDZL', 'simso.schedulers.G_FL', # 'simso.schedulers.G_FL_ZL', 'simso.schedulers.LB_P_EDF', # 'simso.schedulers.LLF', # 'simso.schedulers.MLLF', # 'simso.schedulers.PD2', # 'simso.schedulers.P_EDF2', # 'simso.schedulers.P_EDF', # 'simso.schedulers.P_EDF_WF', # 'simso.schedulers.PriD', 'simso.schedulers.P_RM', 'simso.schedulers.RM', 'simso.schedulers.RUN', # 'simso.schedulers.Static_EDF', ] with open(tasksFileName, 'w+') as csvfile: fieldnames = ['Index', 'Successful', 'Algo', 'NrOfProc', 'Utilization', 'NrOfPeriodic', 'NrOfSporadic', 'AvgPeriod_Periodic', 'AvgActivation_Sporadic', 'TaskName', 'TaskType', 'RespTime', 'Avg_CPU'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for runCounter in range(1, nrOfRuns + 1): nrOfPeriodic = random.randint(minNrOfPeriodicTasks, maxNrOfPeriodicTasks) nrOfSporadic = random.randint(minNrOfSporadicTasks, maxNrOfSporadicTasks) utilization = round(random.uniform(nrOfProc/2, nrOfProc), 1) u = StaffordRandFixedSum(nrOfPeriodic + nrOfSporadic, utilization, 1) p_types = get_periods() p = gen_periods_loguniform(nrOfPeriodic + nrOfSporadic, 1, p_types[1], p_types[2], p_types[3]) if u and p: taskset = gen_tasksets(u, p)[0] print ( "Generating configuration with id " + str(runCounter) + " NrOfPeriodic: " + str(nrOfPeriodic) + ", NrOfSporadic: " + str(nrOfSporadic) + ", Utilization: " + str(utilization)) configuration = Configuration() configuration.duration = 100 * configuration.cycles_per_ms for procCount in range(1, nrOfProc+1): configuration.add_processor(name = "CPU_" + procCount.__str__(), identifier=procCount) i = 0 sumOfPeriods_Periodic = 0 sumOfActivations_Sporadic = 0 for ci, pi in taskset: i += 1 if i <= nrOfPeriodic: configuration.add_task( "Task " + str(i), i, period=pi, wcet=ci, deadline=pi) sumOfPeriods_Periodic += pi else: list_activation_dates = gen_arrivals(pi, 0, configuration.duration_ms) configuration.add_task( "Task " + str(i), i, period=pi, wcet=ci, deadline=pi, task_type="Sporadic", list_activation_dates=list_activation_dates) if (len(list_activation_dates) == 0): sumOfActivations_Sporadic += 0 else: sumOfActivations_Sporadic += sum(list_activation_dates) / len(list_activation_dates) for scheduler in schedulingAlgos: configuration.scheduler_info.clas = scheduler # Init a model from the configuration. model = Model(configuration) # Execute the simulation. successFul = False try: model.run_model() successFul = True except: print('Algorithm ' + scheduler + " failed!") successFul = False print("Finished for algo: " + scheduler) if(successFul): # Print response times for measurement in model._measurements: taskName = measurement._taskName taskType = measurement._taskType respTime = measurement._respTime averageCPULoad = model.getAverageLoad() writer.writerow({fieldnames[0]: runCounter, fieldnames[1]: successFul, fieldnames[2]: scheduler, fieldnames[3]: procCount, fieldnames[4]: utilization, fieldnames[5]: nrOfPeriodic, fieldnames[6]: nrOfSporadic, fieldnames[7]: sumOfPeriods_Periodic / nrOfPeriodic, fieldnames[8]: sumOfActivations_Sporadic / nrOfSporadic, fieldnames[9]: taskName, fieldnames[10]: taskType, fieldnames[11]: respTime, fieldnames[12]: averageCPULoad} ) else: print( "Incorrect configuration: NrOfPeriodic: " + str(nrOfPeriodic) + ", NrOfSporadic: " + str(nrOfSporadic) + ", Utilization: " + str(utilization)) csvfile.close()
def main(argv): if len(argv) == 3: # Configuration load from a file. configuration = Configuration(argv[1]) outputFileName = argv[2] else: raise Exception("Configuration is not correct.") # SPORADIC TASKS ALGOS schedulingAlgos = [ 'simso.schedulers.EDCL', 'simso.schedulers.EDF', 'simso.schedulers.EDF_US', 'simso.schedulers.EDHS', 'simso.schedulers.EDZL', 'simso.schedulers.G_FL', 'simso.schedulers.G_FL_ZL', 'simso.schedulers.LB_P_EDF', 'simso.schedulers.LLF', 'simso.schedulers.MLLF', 'simso.schedulers.PD2', 'simso.schedulers.P_EDF2', 'simso.schedulers.P_EDF', 'simso.schedulers.P_EDF_WF', 'simso.schedulers.PriD', 'simso.schedulers.P_RM', 'simso.schedulers.RM', 'simso.schedulers.RUN', 'simso.schedulers.Static_EDF', ] # Check the config before trying to run it. configuration.check_all() # open csv file with open(outputFileName, 'w') as csvfile: fieldnames = ['Algo'] + Measurement.fieldNames writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for scheduler in schedulingAlgos: # overwrite scheduling algorithm configuration.scheduler_info.clas = scheduler # Init a model from the configuration. model = Model(configuration) # Execute the simulation. model.run_model() configuration = Configuration(argv[1]) print("Finished for algo: " + scheduler) # Print response times for measurement in model._measurements: writer.writerow({ fieldnames[0]: scheduler, fieldnames[1]: measurement._taskName, fieldnames[2]: measurement._taskType, fieldnames[3]: measurement._activationTime, fieldnames[4]: measurement._startTime, fieldnames[5]: measurement._endTime, fieldnames[6]: measurement._deadline, fieldnames[7]: measurement._compTime, fieldnames[8]: measurement._respTime }) csvfile.close()
def main(args): # Load configuration file and check configPath = args.configPaths[args.currentConfigIdx] configuration = Configuration(configPath) configuration.check_all() # Init a model from the configuration. model = Model(configuration) #initial population organism = Organism(args, model.task_list, args.numChrom, shuffleTaskPriority=True, elitePercent=args.ESCperc[0], selectionPercent=args.ESCperc[1], crossOverPercent=args.ESCperc[2], mutationRate=args.mutRate) #Run genetic algorithm for gen in range(args.numGen): organism.checkValid() logger.log(15, "\n---------------\n" + \ f"Running generation {gen+1}..") runStartTime = time.time() for chromosome in organism.chromList: #set chromosome for model to use model = Model(configuration) model.scheduler.initializeChromosome(chromosome) # Execute the simulation. logger.log( 3, Debug.getTaskListStr(chromosome.taskNameToPriority, name='Chromosome Task Priorities')) model.run_model() chromosome.fitness.updateAllFitnessMetrics(model) del model runEndTime = time.time() logger.log( 15, f"..Gen {gen+1} running complete. (Time: {runEndTime-runStartTime:.2f} secs).\n" ) ## After all chromosomes in organism has run... # Record statistics via logging and internally bestChromList = organism.getSortedChromList() totFS, totMig, totPre, totNL, totEC, totChrom = 0.0, 0.0, 0.0, 0.0, 0.0, args.numChrom for rank, chrom in enumerate(bestChromList): chrom.addRank(rank) if rank < PRINTTOP: logger.log(15, f"Rank {rank+1} - Fitness: {chrom.fitness.getFitnessScore()}," \ f" Migrations: {chrom.fitness.getMigrations()}," \ f" Preemptions: {chrom.fitness.getPreemptions()}," \ f" NL: {chrom.fitness.getNormalizedLaxity():.4f}," \ f" Exceeded Count: {chrom.fitness.getExceededCount()}") totFS += chrom.fitness.getFitnessScore() totMig += chrom.fitness.getMigrations() totPre += chrom.fitness.getPreemptions() totNL += chrom.fitness.getNormalizedLaxity() totEC += chrom.fitness.getExceededCount() logger.log(15, f"AVERAGE - Fitness: {totFS/totChrom}," \ f" Migrations: {totMig/totChrom:.1f}," \ f" Preemptions: {totPre/totChrom:.1f}," \ f" NL: {totNL/totChrom:.4f}," \ f" Exceeded Count: {totEC/totChrom:.1f}") organism.avgFitnessDict['FitnessScore'].append(totFS / totChrom) organism.avgFitnessDict['Migrations'].append(totMig / totChrom) organism.avgFitnessDict['Preemptions'].append(totPre / totChrom) organism.avgFitnessDict['NormalizedLaxity'].append(totNL / totChrom) organism.avgFitnessDict['ExceededCount'].append(totEC / totChrom) #Perform the selection, crossover, and mutation organism.checkValid() organism.goNextGen(bestChromList=bestChromList) logger.log( 15, f"\n(Organism & Chromosome overhead: {time.time()-runEndTime:.2f} secs)" ) Results.outputStatsForRun(organism, args)
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 create_trace(scheduler="simso.schedulers.RM", n_tasks=3, seed=None, total_utilization=0.9, method='automotive', alpha=0, jitter=0, is_preemptive=True): redo = True scale = 1 while redo: # Manual configuration: configuration = Configuration() configuration.cycles_per_ms = 1 # Replicate the results for more scheduling policies if seed is not None: np.random.seed(seed) random.seed(seed) # Generate periods and executions according to the specified method periods, wcets = gen_periods_and_exec(n_tasks, total_utilization, method, is_preemptive) # Debugging if method == 'loguniform': divider = 1 / 10 else: divider = 1 / 1000 wcets = wcets / divider hyperperiod = np.lcm.reduce(np.array(periods)) / divider periods = periods / divider wcets = np.round(wcets / scale) * scale for i in range(len(wcets)): if wcets[i] == 0: wcets[i] = scale if alpha == 0: for i in range(n_tasks): configuration.add_task(name="T" + str(i + 1), identifier=i, period=periods[i] / scale, activation_date=0, wcet=wcets[i] / scale, deadline=periods[i] / scale, jitter=jitter) if jitter == 0: configuration.duration = 2 * hyperperiod * configuration.cycles_per_ms / scale # in seconds else: configuration.duration = 10 * hyperperiod * configuration.cycles_per_ms / scale # in seconds else: configuration.etm = 'ucet' ucets = (1 - alpha) * wcets for i in range(n_tasks): configuration.add_task(name="T" + str(i + 1), identifier=i, period=periods[i] / scale, activation_date=0, ucet=ucets[i], wcet=wcets[i] / scale, deadline=periods[i] / scale, jitter=jitter) configuration.duration = 10 * hyperperiod * configuration.cycles_per_ms / scale # in seconds if configuration.duration < 0: continue # Add a processor: configuration.add_processor(name="CPU 1", identifier=1) # Add a scheduler: configuration.scheduler_info.clas = scheduler # 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() redo = False trace = [] prev_time = 0 prev_task = None for log in model.logs: crt_time = log[0] info = log[1][0].split("_") task = int(info[0].split('T')[1]) state = info[1].split(' ') if 'Preempted!' in state: for i in range(1, int((crt_time - prev_time))): trace.append(prev_task) prev_time = crt_time if 'Executing' in state: if prev_time != crt_time: for i in range(0, int((crt_time - prev_time))): trace.append(0) # append idle task prev_time = crt_time # reset counting time interval prev_task = task trace.append(task) if 'Terminated.' in state: for i in range(1, int((crt_time - prev_time))): trace.append(prev_task) prev_time = crt_time return trace, list(map(int, list(periods)))
def simulate(taskset): """Simulation. This method executes the simulation of a task-set. The simulation is run over the hyperperiod, which is the least common mean of all task periods. The task-set is schedulable if all jobs of all tasks in the hyperperiod can meet their deadlines. Args: taskset - the task-set that should be analyzed Return: True - the task-set is schedulable False - the task-set is not schedulable -1 - an error occured """ # create logger logger = logging.getLogger('traditional-SA.simulation.simulate') # Check input argument if taskset is None or not isinstance(taskset, Taskset): logger.error("Invalid input argument or no task-set given!") return -1 # Manual configuration: the configuration class stores all the details about a system configuration = Configuration() # Get the periods of the tasks periods = [] for task in taskset: if task.period not in periods: periods.append(task.period) # Calculate the hyperperiod of the tasks hyper_period = _lcm(periods) logger.debug("simulation.py/simulate(): Hyperperiod H = %d", hyper_period) # Define the length of simulation (= H) configuration.duration = hyper_period * configuration.cycles_per_ms # Add a property 'priority' to the task data fields configuration.task_data_fields[ 'priority'] = 'int' # 'priority' is of type int # Add the tasks to the list of tasks i = 1 for task in taskset: task_name = "T" + str(task.task_id) activation_dates = _get_activation_dates(hyper_period, task.period, task.number_of_jobs) configuration.add_task(name=task_name, identifier=i, task_type="Sporadic", period=task.period, activation_date=0, wcet=task.execution_time, deadline=task.deadline, list_activation_dates=activation_dates, data={'priority': task.priority}) i += 1 # Add a processor to the list of processors configuration.add_processor(name="CPU1", identifier=1) # Add a scheduler: configuration.scheduler_info.filename = "fp_edf_scheduler.py" # use a custom scheduler # Check the correctness of the configuration (without simulating it) before trying to run it configuration.check_all() # Init a model from the configuration model = Model(configuration) # Execute the simulation model.run_model() # Schedulability analysis: check for deadline miss of each job of every task for task in model.results.tasks: # print(task.name + ":") for job in task.jobs: if job.aborted: # deadline miss logger.debug( "simulation.py/simulate(): {0:s} Deadline miss".format( job.name)) return False return True