Beispiel #1
0
    def test_readme_example(self):
        # Simulation configuration
        base_frequency = 1000
        available_frequencies = {base_frequency}
        number_of_cores = 4
        number_of_tasks = 9

        # Task generation
        tasks_deadlines = UniformIntegerDeadlineGenerator.generate(
            number_of_tasks=number_of_tasks,
            min_deadline=2,
            max_deadline=12,
            major_cycle=24)
        x = PTGUUniFastDiscard.generate(utilization=number_of_cores,
                                        tasks_deadlines=tasks_deadlines,
                                        processor_frequency=base_frequency)

        # Definition of the task set
        task_set = TaskSet(periodic_tasks=[
            PeriodicTask(
                identifier=i,
                worst_case_execution_time=j.worst_case_execution_time,
                relative_deadline=j.deadline,
                best_case_execution_time=None,
                execution_time_distribution=None,
                memory_footprint=None,
                priority=None,
                preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                deadline_criteria=Criticality.HARD,
                energy_consumption=None,
                phase=None,
                period=j.deadline) for i, j in enumerate(x)
        ],
                           aperiodic_tasks=[],
                           sporadic_tasks=[])

        # Execute simulation
        simulation_result, periodic_jobs, major_cycle = execute_scheduler_simulation_simple(
            tasks=task_set,
            aperiodic_tasks_jobs=[],
            sporadic_tasks_jobs=[],
            processor_definition=generate_default_cpu(number_of_cores,
                                                      available_frequencies),
            environment_specification=default_environment_specification(),
            simulation_options=SimulationConfiguration(id_debug=True),
            scheduler=SALECS(activate_debug=True))

        # Display execution
        fig = generate_task_execution_plot(task_set=task_set,
                                           schedule_result=simulation_result,
                                           title="Task execution",
                                           outline_boxes=True)
Beispiel #2
0
 def __create_implicit_deadline_periodic_task_h_rt(task_id: int, worst_case_execution_time: int,
                                                   period: float, priority: Optional[int]) -> PeriodicTask:
     # Create implicit deadline task with priority equal to identification id
     return PeriodicTask(identifier=task_id,
                         worst_case_execution_time=worst_case_execution_time,
                         relative_deadline=period,
                         best_case_execution_time=None,
                         execution_time_distribution=None,
                         memory_footprint=None,
                         priority=priority,
                         preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                         deadline_criteria=Criticality.HARD,
                         energy_consumption=None,
                         phase=None,
                         period=period)
Beispiel #3
0
    def test_complex_simulation_periodic_task_set(self):
        task_set = TaskSet(
            periodic_tasks=[
                PeriodicTask(
                    identifier=0, worst_case_execution_time=63, relative_deadline=3.0,
                    best_case_execution_time=None, execution_time_distribution=None,
                    memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD, energy_consumption=None, phase=None,
                    period=3.0),
                PeriodicTask(
                    identifier=1, worst_case_execution_time=1976, relative_deadline=4.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=4.0),
                PeriodicTask(
                    identifier=2, worst_case_execution_time=3408, relative_deadline=12.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=12.0),
                PeriodicTask(
                    identifier=3, worst_case_execution_time=74, relative_deadline=2.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=2.0),
                PeriodicTask(
                    identifier=4, worst_case_execution_time=3285, relative_deadline=15.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=15.0),
                PeriodicTask(
                    identifier=5, worst_case_execution_time=2715, relative_deadline=5.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=5.0),
                PeriodicTask(
                    identifier=6, worst_case_execution_time=408, relative_deadline=6.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=6.0),
                PeriodicTask(
                    identifier=7, worst_case_execution_time=1336, relative_deadline=4.0,
                    best_case_execution_time=None,
                    execution_time_distribution=None, memory_footprint=None, priority=None,
                    preemptive_execution=PreemptiveExecution.FULLY_PREEMPTIVE,
                    deadline_criteria=Criticality.HARD,
                    energy_consumption=None, phase=None, period=4.0)], aperiodic_tasks=[],
            sporadic_tasks=[])

        number_of_cores = 2
        available_frequencies = {1000}

        simulation_result, periodic_jobs, major_cycle = execute_scheduler_simulation_simple(
            tasks=task_set,
            aperiodic_tasks_jobs=[],
            sporadic_tasks_jobs=[],
            processor_definition=generate_default_cpu(number_of_cores, available_frequencies),
            environment_specification=default_environment_specification(),
            simulation_options=SimulationConfiguration(id_debug=True),
            scheduler=SRUN(activate_debug=True, store_clusters_obtained=True)
        )

        # Correct execution
        assert simulation_result.have_been_scheduled
        if simulation_result.hard_real_time_deadline_missed_stack_trace is not None:
            print(simulation_result.hard_real_time_deadline_missed_stack_trace.time)
        assert simulation_result.hard_real_time_deadline_missed_stack_trace is None