示例#1
0
    def create_job(self, pred=None):
        """
        Create a new job from this task. This should probably not be used
        directly by a scheduler.
        """
        self._job_count += 1

        # pick random wcet according to their probabilities
        if isinstance(self.wcet, np.ndarray):
            wcet_sample = random_int_from_distr(self.wcet, n_sample=1)[0]
        else:
            wcet_sample = None

        job = Job(self,
                  "{}_{}".format(self.name, self._job_count),
                  pred,
                  monitor=self._monitor,
                  etm=self._etm,
                  sim=self.sim,
                  wcet=wcet_sample)
        if len(self._activations_fifo) == 0:
            self.job = job
            self.sim.activate(job, job.activate_job())
        self._activations_fifo.append(job)
        self._jobs.append(job)

        timer_deadline = Timer(self.sim, GenericTask._job_killer, (self, job),
                               self.deadline)
        timer_deadline.start()
示例#2
0
文件: Task.py 项目: Sawchord/simso
    def create_job(self, pred=None):
        """
        Create a new job from this task. This should probably not be used
        directly by a scheduler.
        """
        self._job_count += 1
        job = Job(self, "{}_{}".format(self.name, self._job_count), pred,
                  monitor=self._monitor, etm=self._etm, sim=self.sim)

        # This behavior, where the next task is only activated, whenever the old task
        # is done is not what would be expected
        # Therefore we have to fork it to have the correct behavior

        #if len(self._activations_fifo) == 0:
        #    self.job = job
        #    self.sim.activate(job, job.activate_job())
        #self._activations_fifo.append(job)
        #self._jobs.append(job)

        self.job = job
        self.sim.activate(job, job.activate_job())

        timer_deadline = Timer(self.sim, GenericTask._job_killer,
                               (self, job), self.deadline)
        timer_deadline.start()
示例#3
0
    def __init__(self, configuration, callback=None):
        """
        Args:
            - `callback`: A callback can be specified. This function will be \
                called to report the advance of the simulation (useful for a \
                progression bar).
            - `configuration`: The :class:`configuration \
                <simso.configuration.Configuration>` of the simulation.

        Methods:
        """
        Simulation.__init__(self)
        self._logger = Logger(self)
        self._measurements = []
        task_info_list = configuration.task_info_list
        proc_info_list = configuration.proc_info_list
        self._cycles_per_ms = configuration.cycles_per_ms
        self.scheduler = configuration.scheduler_info.instantiate(self)

        try:
            self._etm = execution_time_models[configuration.etm](
                self, len(proc_info_list))
        except KeyError:
            print("Unknowned Execution Time Model.", configuration.etm)

        self._task_list = []
        for task_info in task_info_list:
            self._task_list.append(Task(self, task_info))

        # Init the processor class. This will in particular reinit the
        # identifiers to 0.
        Processor.init()

        # Initialization of the caches
        for cache in configuration.caches_list:
            cache.init()

        self._processors = []
        for proc_info in proc_info_list:
            proc = Processor(self, proc_info)
            proc.caches = proc_info.caches
            self._processors.append(proc)

        # XXX: too specific.
        self.penalty_preemption = configuration.penalty_preemption
        self.penalty_migration = configuration.penalty_migration

        self._etm.init()

        self._duration = configuration.duration
        self.progress = Timer(self,
                              Model._on_tick, (self, ),
                              self.duration // 20 + 1,
                              one_shot=False,
                              in_ms=False)
        self._callback = callback
        self.scheduler.task_list = self._task_list
        self.scheduler.processors = self._processors
        self.results = None
示例#4
0
    def create_job(self, pred=None):
        """
        Create a new job from this task. This should probably not be used
        directly by a scheduler.
        """
        self._job_count += 1
        job = Job(self, "{}_{}".format(self.name, self._job_count), pred,
                  monitor=self._monitor, etm=self._etm, sim=self.sim)

        if len(self._activations_fifo) == 0:
            self.job = job
            self.sim.activate(job, job.activate_job())
        self._activations_fifo.append(job)
        self._jobs.append(job)

        timer_deadline = Timer(self.sim, GenericTask._job_killer,
                               (self, job), self.deadline)
        timer_deadline.start()