------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2020, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR CNRS 6285, Universite de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- ------------------------------------------------------------------------------ -- Last update : -- $Rev$ -- $Date$ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with processors; use processors; with processor_set; use processor_set; with processor_interface; use processor_interface; with scheduler_interface; use scheduler_interface; with core_units; use core_units; use core_units.Core_Units_Table_Package; with tasks; use tasks; with text_io; use text_io; with dependencies; use dependencies; with Task_Dependencies; use Task_Dependencies; use Task_Dependencies.Half_Dep_Set; with Ada.Real_Time; use Ada.Real_Time; with Ada.Calendar; with Ada.Calendar.Formatting; with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_Io; use Ada.Integer_Text_Io; package body scheduling_anomalies_services is --------------------------------------------------------------------------------- procedure dynamically_check_anomaly(inp : in handler_input_parameter; outp : out handler_output_parameter) is begin case inp.event.type_of_event is -- signale la fin d'exécution d'une tache when end_of_task_capacity => handler_end_of_task_capacity(inp, outp); -- signale le debut d'exécution d'une tache when start_of_task_capacity => handler_start_of_task_capacity(inp, outp); -- signale le reveil d'une tache when task_activation => handler_task_activation(inp, outp); -- signale l'execution d'une tache pendant 1 ut de temps when running_task => handler_running_task(inp, outp); when others => null; end case; end dynamically_check_anomaly; --------------------------------------------------------------------------------- -- Vérifie si une anomalie intervient au moment d'une activation de tache -- procedure handler_task_activation(inp : in handler_input_parameter; outp : out handler_output_parameter) is begin --j'analyse si on trouve des anomalies --if j'ai detecte processor_speed_increase anomalie -- then handler_processor_speed_increase(h); --end if; -- put_line("handler_task_activation/event : " & to_string(inp.event.activation_task.name)); -- put_line("handler_task_activation/task number 0 :"); -- put_line("name : " & to_string(inp.runtime_data.tcbs(0).tsk.name)); -- put_line("capacity : " & inp.runtime_data.tcbs(0).tsk.capacity'img); -- put_line("used capacity : " & inp.runtime_data.tcbs(0).Used_Capacity'img); -- put_line("handler_task_activation/task number 1 :"); -- put_line("name : " & to_string(inp.runtime_data.tcbs(1).tsk.name)); -- put_line("capacity : " & inp.runtime_data.tcbs(1).tsk.capacity'img); -- put_line("used capacity : " & inp.runtime_data.tcbs(1).Used_Capacity'img); --j'analyse si on trouve des anomalies --si j'ai detecte l'anomalie processor_speed_increase -- then handler_processor_speed_increase(outp); --end if; -- voici les anomalies detectées dans cette procedure -- handler_processor_add -- handler_precedence_constraint_change -- handler_processor_speed_increase null; end handler_task_activation; procedure handler_running_task(inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; -- si la priorité de la tache qui vient de s'exécuter -- a changé .. alors occurrence anomalie task_priority_change -- invoquer la procedure handler_task_priority_change(outp) -- Anomalies detectées --handler_task_priority_change --handler_task_execution_time_decrease --handler_task_period_increase -- put_line("handler_running_task/Number of task : " & inp.runtime_data.number_of_tasks'img); -- put_line("handler_running_task/event : " & to_string(inp.event.running_task.name) & " " & inp.event.current_priority'img); -- put_line("handler_running_task/task number 0 :"); -- put_line("name : " & to_string(inp.runtime_data.tcbs(0).tsk.name)); -- put_line("capacity : " & inp.runtime_data.tcbs(0).tsk.capacity'img); -- put_line("used capacity : " & inp.runtime_data.tcbs(0).Used_Capacity'img); -- put_line("handler_running_task/task number 1 :"); -- put_line("name : " & to_string(inp.runtime_data.tcbs(1).tsk.name)); -- put_line("capacity : " & inp.runtime_data.tcbs(1).tsk.capacity'img); -- put_line("used capacity : " & inp.runtime_data.tcbs(1).Used_Capacity'img); end handler_running_task; procedure handler_start_of_task_capacity(inp : in handler_input_parameter; outp : out handler_output_parameter) is begin -- voici les anomalies detectées dans cette procedure -- handler_task_execution_time_decrease -- handler_task_late_execution null; end handler_start_of_task_capacity; procedure handler_end_of_task_capacity(inp : in handler_input_parameter; outp : out handler_output_parameter) is begin -- afficher la tache ayant manqué son écheance ce qui cause la non ordonnancabilité du système null; end handler_end_of_task_capacity; --------------------------------------------------------------------------------- procedure handler_processor_speed_increase (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin -- je sais qu'il y a une anomalie "speed increase" -- je remplis "h" avec les donnes à renvoyer null; end handler_processor_speed_increase; procedure handler_processor_add (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; end handler_processor_add; procedure handler_task_execution_time_decrease (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; end handler_task_execution_time_decrease; procedure handler_task_period_increase (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; end handler_task_period_increase; procedure handler_task_late_execution (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; end handler_task_late_execution; procedure handler_task_priority_change (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; end handler_task_priority_change; procedure handler_precedence_constraint_change (inp : in handler_input_parameter; outp : out handler_output_parameter) is begin null; end handler_precedence_constraint_change; ----------------------------------------------------------------------------------- function check_C1_mono_processor_system(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; --Monoprocessor1 : Mono_Core_Processor_Ptr; result : boolean := True; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if (Processor1.processor_type/=Monocore_type) then result:=false; end if; exit when ((is_last_element (a_system.Processors, Iterator1)) or (result=False)); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C1_mono_processor_system; ----------------------------------------------------------------------------------------------- function check_C2_multiprocessor_system(a_system: in system) return Boolean is begin return not check_C1_mono_processor_system(a_system); end check_C2_multiprocessor_system; ------------------------------------------------------------------- function check_C3_partitionned_scheduling(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; result : boolean := true; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if (Processor1.migration_type/=no_migration_type) then result:=false; end if; exit when is_last_element (a_system.Processors, Iterator1); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C3_partitionned_scheduling; -------------------------------------------------------------------- function check_C4_global_scheduling(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; result : boolean := True; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if (not check_C2_multiprocessor_system(a_system)) then result:= False; end if; exit when is_last_element (a_system.Processors, Iterator1); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C4_global_scheduling; -------------------------------------------------------------------- function check_C5_fixed_priority(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; Monoprocessor1 : Mono_Core_Processor_Ptr; Multiprocessor1 : Multi_Cores_Processor_Ptr; result : boolean := true; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if ( check_C1_mono_processor_system(a_system)) then Monoprocessor1:=Mono_Core_Processor_ptr(Processor1); if (Monoprocessor1.core.scheduling.scheduler_type/=rate_monotonic_protocol) and (Monoprocessor1.core.scheduling.scheduler_type/=Posix_1003_Highest_Priority_First_Protocol) and (Monoprocessor1.core.scheduling.scheduler_type/=deadline_monotonic_protocol) then result:=false; end if; else Multiprocessor1:=Multi_Cores_Processor_ptr(Processor1); for i in 0..Multiprocessor1.cores.nb_entries-1 loop if (Multiprocessor1.cores.entries(i).scheduling.scheduler_type/=rate_monotonic_protocol) and (Multiprocessor1.cores.entries(i).scheduling.scheduler_type/=Posix_1003_Highest_Priority_First_Protocol) and (Multiprocessor1.cores.entries(i).scheduling.scheduler_type/=deadline_monotonic_protocol) then result:=false; end if; end loop; end if; exit when is_last_element (a_system.Processors, Iterator1); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C5_fixed_priority; -------------------------------------------------------------------- function check_C6_EDF_algorithm(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; Monoprocessor1 : Mono_Core_Processor_Ptr; Multiprocessor1 : Multi_Cores_Processor_Ptr; result : boolean := true; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if ( check_C1_mono_processor_system(a_system)) then Monoprocessor1:=Mono_Core_Processor_ptr(Processor1); if (Monoprocessor1.core.scheduling.scheduler_type/=Earliest_Deadline_First_Protocol) then result:=false; end if; else Multiprocessor1:=Multi_Cores_Processor_ptr(Processor1); for i in 0..Multiprocessor1.cores.nb_entries-1 loop if (Multiprocessor1.cores.entries(i).scheduling.scheduler_type/=Earliest_Deadline_First_Protocol) then result:=false; end if; end loop; end if; exit when is_last_element (a_system.Processors, Iterator1); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C6_EDF_algorithm; -------------------------------------------------------------------- function check_C7_DM_algorithm(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; Monoprocessor1 : Mono_Core_Processor_Ptr; Multiprocessor1 : Multi_Cores_Processor_Ptr; result : boolean := true; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if ( check_C1_mono_processor_system(a_system)) then Monoprocessor1:=Mono_Core_Processor_ptr(Processor1); if (Monoprocessor1.core.scheduling.scheduler_type/=Deadline_Monotonic_Protocol) then result:=false; end if; else Multiprocessor1:=Multi_Cores_Processor_ptr(Processor1); for i in 0..Multiprocessor1.cores.nb_entries-1 loop if (Multiprocessor1.cores.entries(i).scheduling.scheduler_type/=Deadline_Monotonic_Protocol) then result:=false; end if; end loop; end if; exit when is_last_element (a_system.Processors, Iterator1); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C7_DM_algorithm; -------------------------------------------------------------------- function check_C8_preemptive_processor(a_system: in system) return Boolean is Iterator1 : Processors_Iterator; Processor1 : Generic_Processor_Ptr; Monoprocessor1 : Mono_Core_Processor_Ptr; Multiprocessor1 : Multi_Cores_Processor_Ptr; result : boolean := true; begin reset_iterator (a_system.Processors, Iterator1); loop current_element (a_system.Processors, Processor1, Iterator1); if ( check_C1_mono_processor_system(a_system)) then Monoprocessor1:=Mono_Core_Processor_ptr(Processor1); if (Monoprocessor1.core.scheduling.preemptive_type/=preemptive) then result:=false; end if; else Multiprocessor1:=Multi_Cores_Processor_ptr(Processor1); for i in 0..Multiprocessor1.cores.nb_entries-1 loop if (Multiprocessor1.cores.entries(i).scheduling.preemptive_type/=preemptive) then result:=false; end if; end loop; end if; exit when is_last_element (a_system.Processors, Iterator1); next_element (a_system.Processors, Iterator1); end loop; return result; end check_C8_preemptive_processor; -------------------------------------------------------------------- function check_C9_non_preemptive_processor(a_system: in system) return Boolean is begin return not check_C8_preemptive_processor(a_system); end check_C9_non_preemptive_processor; -------------------------------------------------------------------- function check_C10_synchronous_departure(a_system: in system) return Boolean is Iterator1 : Tasks_Iterator; Task1, Task0 : Generic_Task_Ptr; result : boolean := true; begin reset_iterator (a_system.Tasks, Iterator1); current_element (a_system.Tasks, Task0, Iterator1); loop current_element (a_system.Tasks, Task1, Iterator1); if (Task1.start_time /= Task0.start_time) then result:=false; end if; exit when is_last_element (a_system.Tasks, Iterator1); next_element (a_system.Tasks, Iterator1); end loop; return result; end check_C10_synchronous_departure; -------------------------------------------------------------------- function check_C11_asynchronous_departure(a_system: in system) return Boolean is begin return not check_C10_synchronous_departure(a_system); end check_C11_asynchronous_departure; -------------------------------------------------------------------- function check_C12_tasks_are_periodic(a_system: in system) return Boolean is Iterator1 : Tasks_Iterator; Task1 : Generic_Task_Ptr; result : boolean := true; begin reset_iterator (a_system.Tasks, Iterator1); loop current_element (a_system.Tasks, Task1, Iterator1); if (Task1.task_type /= Periodic_Type) then result:=false; end if; exit when is_last_element (a_system.Tasks, Iterator1); next_element (a_system.Tasks, Iterator1); end loop; return result; end check_C12_tasks_are_periodic; -------------------------------------------------------------------- function check_C13_tasks_are_independent(a_system: in system) return Boolean is My_Dependencies : Tasks_Dependencies_Ptr; result : boolean := true; begin My_Dependencies:=a_system.Dependencies; if not is_empty (My_Dependencies.Depends) then result := False; end if; return result; end check_C13_tasks_are_independent; -------------------------------------------------------------------- function check_C14_tasks_are_suspended(a_system: in system) return Boolean is result : boolean := False; begin null; return result; end check_C14_tasks_are_suspended; -------------------------------------------------------------------- function check_C15_tasks_have_precedence_constraint(a_system: in system) return Boolean is My_Dependencies : Tasks_Dependencies_Ptr; My_Iterator1 : Tasks_Dependencies_Iterator; A_Half_Dep : Dependency_Ptr; result : boolean := true; begin My_Dependencies:=a_system.Dependencies; if not is_empty (My_Dependencies.Depends) then reset_iterator (My_Dependencies.Depends, My_Iterator1); loop current_element (My_Dependencies.Depends, A_Half_Dep, My_Iterator1); if (A_Half_Dep.type_of_dependency /= precedence_Dependency) then result := False; end if; exit when is_last_element (My_Dependencies.Depends, My_Iterator1); next_element (My_Dependencies.Depends, My_Iterator1); end loop; else result := False; end if; return result; end check_C15_tasks_have_precedence_constraint; -------------------------------------------------------------------- function check_C16_tasks_have_shared_resouces(a_system: in system) return Boolean is My_Dependencies : Tasks_Dependencies_Ptr; My_Iterator1 : Tasks_Dependencies_Iterator; A_Half_Dep : Dependency_Ptr; result : boolean := true; begin My_Dependencies:=a_system.Dependencies; if not is_empty (My_Dependencies.Depends) then reset_iterator (My_Dependencies.Depends, My_Iterator1); loop current_element (My_Dependencies.Depends, A_Half_Dep, My_Iterator1); if (A_Half_Dep.type_of_dependency /= Resource_Dependency) then result := False; end if; exit when is_last_element (My_Dependencies.Depends, My_Iterator1); next_element (My_Dependencies.Depends, My_Iterator1); end loop; else result := False; end if; return result; end check_C16_tasks_have_shared_resouces; -------------------------------------------------------------------- function check_C17_tasks_are_aperiodic(a_system: in system) return Boolean is Iterator1 : Tasks_Iterator; Task1 : Generic_Task_Ptr; result : boolean := true; begin reset_iterator (a_system.Tasks, Iterator1); loop current_element (a_system.Tasks, Task1, Iterator1); if (Task1.task_type /= Aperiodic_Type) then result:=false; end if; exit when is_last_element (a_system.Tasks, Iterator1); next_element (a_system.Tasks, Iterator1); end loop; return result; end check_C17_tasks_are_aperiodic; -------------------------------------------------------------------------------- function check_static_processor_speed_increase(a_system : in system) return boolean is --C1, C3, C5, C8, C11, C12, C16 --C1, C3, C5, C9, C11, C12, C13 begin return (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C8_preemptive_processor(a_system) and check_C11_asynchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C16_tasks_have_shared_resouces(a_system)) or (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C9_non_preemptive_processor(a_system) and check_C11_asynchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system)); end check_static_processor_speed_increase; -------------------------------------------------------------------------- function check_static_task_execution_time_decrease(a_system : in system) return Boolean is --C1, C3, C5, C10, C12, C15 --C1, C3, C5, C9, C10, C12, C13 --C1, C3, C7, C8, C10, C12, C16 --C1, C3, C6, C8, C11, C12,C13, C14 --C2, C4,C5, C8, C11, C12, C13, C17 --C2, C3, C5, C9, C10, C12, C16 --C2, C4, C5, C9, C10, C12, C15 begin return (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C15_tasks_have_precedence_constraint(a_system)) or (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority (a_system) and check_C9_non_preemptive_processor (a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system)) or (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C7_DM_algorithm(a_system) and check_C8_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C16_tasks_have_shared_resouces(a_system)) or (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C6_EDF_algorithm(a_system) and check_C8_preemptive_processor(a_system) and check_C11_asynchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system) and check_C14_tasks_are_suspended(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C8_preemptive_processor(a_system) and check_C11_asynchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system) and check_C17_tasks_are_aperiodic(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority (a_system) and check_C9_non_preemptive_processor (a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C16_tasks_have_shared_resouces(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C5_fixed_priority (a_system) and check_C9_non_preemptive_processor (a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C15_tasks_have_precedence_constraint(a_system)); end check_static_task_execution_time_decrease; --------------------------------------------------------------------------- function check_static_processor_add(a_system : in system) return boolean is --C2, C4, C5, C9, C10, C12, C15 begin return (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C9_non_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C15_tasks_have_precedence_constraint(a_system)) ; end check_static_processor_add; function check_static_task_period_increase(a_system : in system) return boolean is --C2, C4, C7, C10, C12, C13 --C2, C4, C5, C8, C10, C12, C13 --C2, C4, C6, C8, C10, C12, C13 --C2, C3, C5, C8, C10, C12, C13 begin return (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C7_DM_algorithm(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C8_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C6_EDF_algorithm(a_system) and check_C8_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C8_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C13_tasks_are_independent(a_system)); end check_static_task_period_increase; function check_static_task_late_execution(a_system : in system) return boolean is -- C1, C3, C5, C8, C10, C12, c16 begin return (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C8_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C16_tasks_have_shared_resouces(a_system)); end check_static_task_late_execution; function check_static_task_priority_change(a_system : in system) return boolean is --C2, C4, C5, C9, C10, C12, C15 begin return (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C9_non_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C15_tasks_have_precedence_constraint(a_system)); end check_static_task_priority_change; function check_static_precedence_constraint_change(a_system : in system) return boolean is --C1, C3, C5, C10, C12, C15 --C2, C4, C5, C9, C10, C12, C15 begin return (check_C1_mono_processor_system(a_system) and check_C3_partitionned_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C15_tasks_have_precedence_constraint(a_system)) or (check_C2_multiprocessor_system(a_system) and check_C4_global_scheduling(a_system) and check_C5_fixed_priority(a_system) and check_C9_non_preemptive_processor(a_system) and check_C10_synchronous_departure(a_system) and check_C12_tasks_are_periodic(a_system) and check_C15_tasks_have_precedence_constraint(a_system)); end check_static_precedence_constraint_change; ----------------------------------------------------------------------- function print_duration_time_exec return String is The_Clock : Constant Ada.Real_Time.Time := Ada.Real_Time.Clock; -- Convert to Time_Span As_Time_Span : Ada.Real_Time.Time_Span; --:= The_Clock - Time_Of(0, Time_Span_Zero); -- Epoch ? -- Epoch : constant Ada.Calendar.Time := Ada.Calendar.Time_Of(1970, 01, 01); -- Dur ? Dur : Duration; begin As_Time_Span := Ada.Real_Time.Clock - The_Clock; Dur := Ada.Real_Time.To_Duration(As_Time_Span); return Duration'Image(Dur); end print_duration_time_exec; --------------------------------------------------------------------- procedure check_static_constraint(a_system : in system; to_check : in anomaly_type; result : out boolean) is begin null; end check_static_constraint; procedure check_dynamic_constraint(a_system : in system; to_check : in anomaly_type) is begin null; end check_dynamic_constraint; procedure scheduling_anomalies_analyzer(a_system : in system; msg : out unbounded_string) is result : boolean; The_Clock : Constant Ada.Real_Time.Time := Ada.Real_Time.Clock; -- Convert to Time_Span As_Time_Span : Ada.Real_Time.Time_Span; --:= The_Clock - Time_Of(0, Time_Span_Zero); Dur, Dur1 : Duration; msg1: Unbounded_String; begin -- msg1:=To_Unbounded_String(print_duration_time_exec); --Put_Line(To_String(msg1)); As_Time_Span := Ada.Real_Time.Clock - The_Clock; Dur := Ada.Real_Time.To_Duration(As_Time_Span); msg1:=To_Unbounded_String("debut de la procedure scheduling_anomalies:" & Duration'Image(Dur)); Put_Line(To_String(msg1)); result:=check_C1_mono_processor_system(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C1_uniprocessor =" & result'img); result:=check_C2_multiprocessor_system(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C2_MultiProcessor =" & result'img); result:=check_C3_partitionned_scheduling(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C3:Partitionned Scheduling =" & result'img); result:=check_C4_global_scheduling(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C4:Multiprocessor with global scheduling =" & result'img); result:=check_C5_fixed_priority(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C5:fixed priority =" & result'img); result:=check_C6_EDF_algorithm(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C6:Algorithm EDF =" & result'img); result:=check_C7_DM_algorithm(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C7:Algorithm DM =" & result'img); result:=check_C8_preemptive_processor(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C8:Preemptive system =" & result'img); result:=check_C9_non_preemptive_processor(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C9:Non preemptive system =" & result'img); result:=check_C10_synchronous_departure(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C10:synchronous departure = " & result'img); result:=check_C11_asynchronous_departure(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C11:asynchronous departure = " & result'img); result:=check_C12_tasks_are_periodic(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C12:Periodic Tasks = " & result'img); result:=check_C13_tasks_are_independent(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C13:tasks are independent = " & result'img); result:=check_C14_tasks_are_suspended(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C14:tasks are suspended = " & result'img); result:=check_C15_tasks_have_precedence_constraint(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C15:tasks have precedence constraint = " & result'img); result:=check_C16_tasks_have_shared_resouces(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C16:Shared resources = " & result'img); result:=check_C17_tasks_are_aperiodic(a_system); msg:= msg & ASCII.LF & to_unbounded_string("Condition C17:tasks are aperiodics = " & result'img); As_Time_Span := Ada.Real_Time.Clock - The_Clock; Dur1 := Ada.Real_Time.To_Duration(As_Time_Span); Dur :=Dur1-Dur; msg1:=To_Unbounded_String("fin de la procedure scheduling_anomalies:" & Duration'Image(Dur1)); Put_Line(To_String(msg1)); msg1:=To_Unbounded_String("temps execution de la procedure scheduling_anomalies:" & Duration'Image(Dur)); Put_Line(To_String(msg1)); end scheduling_anomalies_analyzer; end scheduling_anomalies_services;