------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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 text_io; use text_io; with Xml_Tag; use Xml_Tag; with Scheduler.Fixed_Priority; use Scheduler.Fixed_Priority; with Scheduler.Fixed_Priority.Dm; use Scheduler.Fixed_Priority.Dm; with Scheduler.Fixed_Priority.Rm; use Scheduler.Fixed_Priority.Rm; with double_util; use double_util; with Translate; use Translate; with Tasks; use Tasks; with task_group_set; use task_group_set; with Event_Analyzers; use Event_Analyzers; with Event_Analyzer_Set; use Event_Analyzer_Set; with Event_Analyzer_Set; use Event_Analyzer_Set.Generic_Event_Analyzer_Set; with Ada.Numerics.Aux; use Ada.Numerics.Aux; with unbounded_strings; use unbounded_strings; with Scheduling_Analysis; use Scheduling_Analysis; with GNAT.Current_Exception; use GNAT.Current_Exception; with Expressions; use Expressions; with Framework_Config; use Framework_Config; with Time_Unit_Events; use Time_Unit_Events; with Multiprocessor_Services; use Multiprocessor_Services; with partitioning_Services; use partitioning_Services; with Debug; use Debug; with priority_assignment.dm; use priority_assignment.dm; with priority_assignment.rm; use priority_assignment.rm; with Priority_Assignment.Audsley_OPA; use Priority_Assignment.Audsley_OPA; with Priority_Assignment; use Priority_Assignment; with Cache_Set; use Cache_Set; with Priority_Assignment.Audsley_OPA_CRPD; use Priority_Assignment.Audsley_OPA_CRPD; with Ellidiss_Tools; use Ellidiss_Tools; with feasibility_test; use feasibility_test; with feasibility_test.processor_utilization; use feasibility_test.processor_utilization; with feasibility_test.feasibility_interval; use feasibility_test.feasibility_interval; with feasibility_test.periodic_task_worst_case_response_time; use feasibility_test.periodic_task_worst_case_response_time; with feasibility_test.transaction_worst_case_response_time; use feasibility_test.transaction_worst_case_response_time; with Scheduling_Analysis.extended.task_analysis; use Scheduling_Analysis.extended.task_analysis; with framework; use framework; with Core_Units; use Core_Units; use Core_Units.Core_Units_Table_Package; with Caches; use Caches; with Cache_Block_Set; use Cache_Block_Set; with Cache_Access_Profile_Set; use Cache_Access_Profile_Set; with processor_interface; use processor_interface; with feasibility_test.processor_demand; use feasibility_test.processor_demand; package body Call_Scheduling_Framework is procedure Compute_Simulation_Time_Line (Sys : in out System; Result : in out Unbounded_String; Period : in Natural; Options : in Scheduling_Option; Event_To_Generate : in Time_Unit_Event_Type_Boolean_Table; Output : in Output_Format := String_Output) is begin Put_Debug ("Call Compute_Simulation_Time_Line"); sort (Sys.Tasks, Increasing_Name'Access); Scheduling_Base_Period := Period; initialize (Sched.all); Build_Multiprocessor_Scheduling (Sys, Sched, Event_To_Generate, Period, Options); exception when Exit_Statement_Exception => Result := Result & Lb_Minus & Lb_Simulation_warning (Current_Language) & Exception_Message & unbounded_lf; when Parametric_File_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Parametric_File_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Type_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Type_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Statement_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Statement_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Variable_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Variable_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Syntax_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Syntax_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Time_Unit_Package.indexed_table_full => Result := Result & Lb_Compute_Scheduling_Error_22 (Current_Language) & unbounded_lf; initialize (Sched.all); when Cache_Access_Profile_Must_Be_Defined => Result := Result & unbounded_lf & Lb_Cache_Access_Profile_Must_Be_Defined (Current_Language) & unbounded_lf; end Compute_Simulation_Time_Line; procedure Compute_Simulation_Basics (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Check : Unbounded_String; begin Put_Debug ("Call Compute_Simulation_Basics"); if Output = Xml2_Output then Result := Result & Elli_Feasibility_Test & To_Unbounded_String (" name=""") & Lb_Task_Response_Time_From_Simulation (Current_Language) & To_Unbounded_String (""" reference=""") & A_Processor.name & To_Unbounded_String (""">") & unbounded_lf; end if; Check := empty_string; Compute_Simulation_Number_Of_Context_Switch (Sys, Check, A_Processor, Output); Result := Result & Check; Check := empty_string; Compute_Simulation_Number_Of_Preemption (Sys, Check, A_Processor, Output); Result := Result & Check; Check := empty_string; Compute_Simulation_Response_Time (Sys, Check, A_Processor, True, False, False, Output); Result := Result & unbounded_lf & Check & unbounded_lf; if Output = Xml2_Output then Result := Result & Elli_Close_Feasibility_Test & unbounded_lf; end if; end Compute_Simulation_Basics; procedure Compute_Simulation_Number_Of_Context_Switch (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Nb : Natural := 0; Nb_Str : Unbounded_String := empty_string; begin Put_Debug ("Call Compute_Simulation_Number_Of_Context_Switch"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; for J in 0 .. Sched.nb_entries - 1 loop if Sched.entries (J).item.name = A_Processor.name then if Sched.entries (J).data.error_msg /= empty_string then if Output /= Xml2_Output then Result := Result & Sched.entries (J).data.error_msg & unbounded_lf; end if; Nb_Str := empty_string; else Nb := Number_Of_Switch_Context_From_Simulation (Sched.entries (J).data.result); Nb_Str := To_Unbounded_String (Nb'Img); if Output /= Xml2_Output then Result := Result & Start_Line & Lb_Minus & Lb_Number_Of_Context_Switch (Current_Language) & Lb_Colon & Start_Num_Of_Context_Switch & Nb'Img & End_Num_Of_Context_Switch & End_Line & unbounded_lf; end if; end if; if Output = Xml2_Output then Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Number_Of_Context_Switch (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Processor.name & To_Unbounded_String ("""") & To_Unbounded_String (" value=""") & Nb_Str & To_Unbounded_String (""" note=""") & Sched.entries (J).data.error_msg & To_Unbounded_String (""" biblio=") & To_Unbounded_String ("""""/>") & unbounded_lf; end if; end if; end loop; end Compute_Simulation_Number_Of_Context_Switch; procedure Compute_Simulation_Number_Of_Preemption (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Nb : Natural := 0; Nb_Str : Unbounded_String := empty_string; begin Put_Debug ("Call Compute_Simulation_Number_Of_Preemption"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; for J in 0 .. Sched.nb_entries - 1 loop if Sched.entries (J).item.name = A_Processor.name then if Sched.entries (J).data.error_msg /= empty_string then if Output /= Xml2_Output then Result := Result & Sched.entries (J).data.error_msg & unbounded_lf; end if; Nb_Str := empty_string; else Nb := Number_Of_Preemption_From_Simulation (Sched.entries (J).data.result, Sys.Tasks); Nb_Str := To_Unbounded_String (Nb'Img); if Output /= Xml2_Output then Result := Result & Sched.entries (J).data.scheduling_msg; Result := Result & Start_Line & Lb_Minus & Lb_Number_Of_Preemption (Current_Language) & Lb_Colon & Start_Num_Of_Preemp & Nb'Img & End_Num_Of_Preemp & End_Line & unbounded_lf; end if; end if; if Output = Xml2_Output then Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Number_Of_Preemption (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Processor.name & To_Unbounded_String ("""") & To_Unbounded_String (" value=""") & Nb_Str & To_Unbounded_String (""" note=""") & Sched.entries (J).data.error_msg & To_Unbounded_String (""" biblio=") & To_Unbounded_String ("""""/>") & unbounded_lf; end if; end if; end loop; end Compute_Simulation_Number_Of_Preemption; procedure Compute_Simulation_Response_Time (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Worst_Case : Boolean; Best_Case : Boolean; Average_Case : Boolean; Output : in Output_Format := String_Output) is Check : Unbounded_String := empty_string; A_Task : Generic_Task_Ptr; My_Iterator : Tasks_Iterator; Min : Natural := 0; Max : Natural := 0; Average : Double := 0.0; Missed : Boolean := False; completed : Boolean := true; has_error : boolean :=false; A_Scheduler : Generic_Scheduler_Ptr; preemptive : Unbounded_String := empty_string; Max_Str : Unbounded_String := empty_string; Min_Str : Unbounded_String := empty_string; Average_Str : Unbounded_String := empty_string; error_str : Unbounded_String := empty_string; begin Put_Debug ("Call Compute_Simulation_Response_Time"); for J in 0 .. Sched.nb_entries - 1 loop if Sched.entries (J).item.name = A_Processor.name then if Sched.entries (J).data.error_msg /= empty_string then has_error := true; error_str := Sched.entries (J).data.error_msg; end if; if Get_Number_Of_Task_From_Processor(Sys.Tasks, A_Processor.name) > 0 then if Output /= Xml2_Output then Result := Lb_Minus & Lb_Task_Response_Time_From_Simulation (Current_Language) & Lb_Colon & unbounded_lf; end if; reset_iterator (Sys.Tasks, My_Iterator); loop current_element (Sys.Tasks, A_Task, My_Iterator); Check := empty_string; if (A_Processor.name = A_Task.cpu_name) then Response_Time_By_Simulation(A_Task, Sched.entries (J).data.result, Check, Max, Min, Average); if Output /= Xml2_Output then Result := Result & Start_Task & To_Unbounded_String (" ") & A_Task.name & To_Unbounded_String (" =>"); else Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Task_Response_Time_From_Simulation ( Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Task.name & To_Unbounded_String (""""); end if; if Output = Xml2_Output then if (Worst_Case) and (Max = 0) then Max_Str := empty_string; Min_Str := empty_string; Average_Str := empty_string; else Max_Str := To_Unbounded_String (Max'Img); Min_Str := To_Unbounded_String (Min'Img); Average_Str := format(Average); end if; end if; if Worst_Case then if Output /= Xml2_Output then Result := Result & Max'Img & To_Unbounded_String ("/worst "); else Result := Result & To_Unbounded_String (" worst=") & To_Unbounded_String ("""") & Max_Str & To_Unbounded_String (""""); end if; end if; if Best_Case then if Output /= Xml2_Output then Result := Result & Min'Img & To_Unbounded_String ("/best "); else Result := Result & To_Unbounded_String (" best=") & To_Unbounded_String ("""") & Min_Str & To_Unbounded_String (""""); end if; end if; if Average_Case then if Output /= Xml2_Output then Result := Result & format (Average) & To_Unbounded_String ("/average "); else Result := Result & To_Unbounded_String (" average=") & To_Unbounded_String ("""") & Average_Str & To_Unbounded_String (""""); end if; end if; if (Worst_Case) and (Max = 0) then if Output /= Xml2_Output then Result := Result & Lb_Comma & lb_task_is_not_over_response_time_is_not_computed(Current_Language); else Result := Result & To_Unbounded_String (" note=") & To_Unbounded_String ("""") & lb_task_is_not_over_response_time_is_not_computed(Current_Language) & To_Unbounded_String (""""); end if; completed:=false; end if; if Output = Xml2_Output then Result := Result & To_Unbounded_String (" biblio=") & To_Unbounded_String ("""""/>") & unbounded_lf; else Result := Result & Check & unbounded_lf; end if; if Check /= empty_string then Missed := True; end if; if Output /= Xml2_Output then Result:= Result & End_Task; end if; end if; exit when is_last_element (Sys.Tasks, My_Iterator); next_element (Sys.Tasks, My_Iterator); end loop; end if; end if; end loop; -- test the feasibility if Output = Xml2_Output then A_Scheduler := build_a_scheduler (A_Processor); if Get_Preemptive (A_Scheduler.all) = "PREEMPTIVE" then preemptive := To_Unbounded_String ("true"); else preemptive := To_Unbounded_String ("false"); end if; Result := Result & Elli_Schedulability; Result := Result & To_Unbounded_String (" scheduler=""") & Get_Name (A_Scheduler.all) & To_Unbounded_String ("""") & To_Unbounded_String (" preemptive=""") & preemptive & To_Unbounded_String (""""); end if; if not has_error then if completed = true then if Missed = False then if Output /= Xml2_Output then Result := Result & Lb_No_Deadline_Missed_In_The_Computed_Scheduling (Current_Language) & unbounded_lf; else Result := Result & To_Unbounded_String(" result=""true"" explanation=""") & Lb_No_Deadline_Missed_In_The_Computed_Scheduling (Current_Language) & unbounded_lf; end if; else if Output /= Xml2_Output then Result := Result & Lb_Deadline_Will_Be_Missed_Task_Are_Not_Schedulable (Current_Language) & unbounded_lf; else Result := Result & To_Unbounded_String(" result=""false"" explanation=""") & Lb_Deadline_Will_Be_Missed_Task_Are_Not_Schedulable (Current_Language) & unbounded_lf; end if; end if; else if Output /= Xml2_Output then Result := Result & Lb_Cannot_Say_If_Deadline_will_be_Missed_In_The_Computed_Scheduling(Current_Language); else Result := Result & To_Unbounded_String(" result=""false"" explanation=""") & Lb_Cannot_Say_If_Deadline_will_be_Missed_In_The_Computed_Scheduling(Current_Language); end if; end if; if Output = Xml2_Output then Result := Result & To_Unbounded_String (""""); end if; else if Output = Xml2_Output then Result := Result & To_Unbounded_String(" result=""false"" explanation=""") & error_str & To_Unbounded_String (""""); end if; end if; if Output = Xml2_Output then Result := Result & To_Unbounded_String (" biblio=") & To_Unbounded_String ("""""/>"); end if; end Compute_Simulation_Response_Time; procedure Compute_Feasibility_Interval (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Period_String : Unbounded_String; Free_Ut_String : Unbounded_String; Period : Double := 0.0; Util : Double := 0.0; Free_Ut : Double := 0.0; Validate : Boolean; Msg : Unbounded_String; begin Put_Debug ("Call Compute_Feasibility_Interval"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; begin Calculate_Feasibility_Interval (Sys, A_Processor, Validate, Period, Msg); exception when constraint_error => -- A large task set with many different period values can lead to -- a CONSTRAINT_ERROR exception due to type overflow -- Result:= Result & Start_Line & To_Unbounded_String ("- ") & Exception_Name & " " & Exception_Message & End_Line & unbounded_lf; Result:= Result & Start_Line & To_Unbounded_String ("-") & "Cheddar warning: Scheduling period overflow! " & End_Line & unbounded_lf; end; Period_String := " " & format(Period,0); if Output = Xml2_Output then Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Elli_Base_Period (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Processor.name & To_Unbounded_String ("""") & To_Unbounded_String (" value=""") & format (Period) & To_Unbounded_String (""" biblio=""") & Msg& To_Unbounded_String (""""); else Result := Result & Start_Line & Lb_Scheduling_Period (Current_Language) & Start_Bas_Per & Period_String & End_Bas_Per & Start_Ref & Msg & End_Ref & End_Line & unbounded_lf; end if; Util := Processor_Utilization_Over_Period (Sys.Tasks, A_Processor.name); if (A_processor.processor_type = Monocore_type) then Free_Ut := Period * (1.0 - Util); else Free_Ut := Period * (Double(Multi_Cores_Processor_Ptr(A_processor).cores.nb_entries) - Util); end if; Free_Ut := Double'Max (0.0, Free_Ut); if Free_Ut > Double (Natural'Last) then Free_Ut_String := To_Unbounded_String (Double'Image (Free_Ut)); else Free_Ut_String := To_Unbounded_String (Natural'Image (Natural (Free_Ut))); end if; if Output = Xml2_Output then Result := Result & To_Unbounded_String (" unused=""") & format (Free_Ut) & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Start_Line & To_Unbounded_String ("-") & Start_Unit & Free_Ut_String & End_Unit & Lb_Free_Unit_Time (Current_Language) & End_Line & unbounded_lf; end if; exception when Task_Set.Task_Must_Be_Periodic => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" exception=""") & Lb_Compute_Scheduling_Error_2 (Current_Language) & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_2 (Current_Language) & unbounded_lf; end if; when Task_Set.Task_Model_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" exception=""") & Lb_Compute_Scheduling_Error_3 (Current_Language) & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_3 (Current_Language) & unbounded_lf; end if; end Compute_Feasibility_Interval; procedure Compute_Feasibility_Processor_Utilization_Factor (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Util : Double; Utildi : Double; a_scheduler : generic_scheduler_ptr; preemptive : Unbounded_String := empty_string; begin Put_Debug ("Call Compute_Feasibility_Processor_Utilization_Factor"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; -- Compute feasibility interval -- if Output /= Xml2_Output then Result := Result & Lb_Feasibility_Number1 (Current_Language) & unbounded_lf & unbounded_lf; end if; Compute_Feasibility_Interval (Sys, Result, A_Processor, Output); if Output = Xml2_Output then Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Elli_Utilization_Factor_Deadline (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Processor.name & To_Unbounded_String (""""); end if; -- Compute number of cores of the processor -- if Output = Xml_Output then if (A_processor.processor_type = Monocore_type) then Result := Result & Lb_Processor_has_number_of_cores(current_language) & To_Unbounded_String (" 1. ") & unbounded_lf; else Result := Result & Lb_Processor_has_number_of_cores(current_language) & To_Unbounded_String (" " & Multi_Cores_Processor_Ptr(A_processor).cores.nb_entries'img & ". ") & unbounded_lf; end if; end if; -- Compute processor utilization faction over deadline -- begin Utildi := Processor_Utilization_Over_Deadline (Sys.Tasks, A_Processor.name); if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""") & format (Utildi) & To_Unbounded_String (""" biblio=") & To_Unbounded_String ("""[1], page 6""") & To_Unbounded_String ("/>") & unbounded_lf; else Result := Result & Start_Line & Lb_Utilization_With_Deadline (Current_Language) & Start_Deadl_Fact & format (Utildi) & End_Deadl_Fact & Start_Ref & To_Unbounded_String (" (") & Lb_See (Current_Language) & To_Unbounded_String ("[1], page 6). ") & End_Ref & End_Line & unbounded_lf; end if; exception when Task_Set.Task_Must_Be_Periodic => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""NA"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_9 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_9 (Current_Language) & unbounded_lf; end if; when Task_Set.Task_Model_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""NA"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language) & unbounded_lf; end if; when Deadline_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""NA"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_21 (Current_Language) & unbounded_lf; end if; end; if Output = Xml2_Output then Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Elli_Utilization_Factor_Period (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Processor.name & To_Unbounded_String (""""); end if; -- Compute processor utilization factor over period -- begin Util := Processor_Utilization_Over_Period (Sys.Tasks, A_Processor.name); if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""") & format (Util) & To_Unbounded_String (""" biblio=") & To_Unbounded_String ("""[1], page 6""") & To_Unbounded_String ("/>") & unbounded_lf; else Result := Result & Start_Line & Lb_Utilization_With_Period (Current_Language) & Start_Per_Fact & format (Util) & End_Per_Fact & Start_Ref & To_Unbounded_String (" (") & Lb_See (Current_Language) & To_Unbounded_String ("[1], page 6). ") & End_Ref & unbounded_lf; end if; exception when Task_Set.Task_Must_Be_Periodic => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""NA"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_9 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_9 (Current_Language) & unbounded_lf; end if; when Task_Set.Task_Model_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" value=""NA"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language) & unbounded_lf; end if; end; if (A_processor.processor_type = Monocore_type) then -- Compute feasibility test on the Processor utilization bound -- begin a_scheduler:=build_a_scheduler(A_Processor); if Output = Xml2_Output then Result := Result & Elli_Schedulability; if Get_Preemptive (A_Scheduler.all) = "PREEMPTIVE" then preemptive := To_Unbounded_String ("true"); else preemptive := To_Unbounded_String ("false"); end if; Result := Result & To_Unbounded_String (" scheduler=""") & Get_Name (A_Scheduler.all) & To_Unbounded_String ("""") & To_Unbounded_String (" preemptive=""") & preemptive & To_Unbounded_String (""""); Utilization_Factor_Feasibility_Test ( a_scheduler, Sys.Tasks, A_Processor.name, Result, Xml2_Output); Result := Result & To_Unbounded_String ("/>") & unbounded_lf; else Result := Result & Start_Line; Utilization_Factor_Feasibility_Test ( a_scheduler, Sys.Tasks, A_Processor.name, Result); end if; free(a_scheduler); exception when Task_Set.Task_Must_Be_Periodic => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_9 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_9 (Current_Language) & unbounded_lf; end if; when Task_Set.Task_Model_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_10 (Current_Language) & unbounded_lf; end if; when Deadline_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_21 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_21 (Current_Language) & unbounded_lf; end if; when Task_Set.Start_Time_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_23 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_23 (Current_Language) & unbounded_lf; end if; when Task_Set.Offset_Error => if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); Result := Result & Lb_Compute_Scheduling_Error_24 (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("""/>") & unbounded_lf; else Result := Result & Lb_Compute_Scheduling_Error_24 (Current_Language) & unbounded_lf; end if; end; end if; end Compute_Feasibility_Processor_Utilization_Factor; procedure Compute_feasibility_test_by_name (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; test_name : unbounded_string; Output : in Output_Format := String_Output) is begin Put_Debug ("Call Compute_Feasibility_Test_By_Name"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; Result := Result & unbounded_lf ; end Compute_feasibility_test_by_name; procedure Compute_Feasibility_Response_Time (Sys : in out System; Result : in out Unbounded_String; a_transaction : in transaction_wcrt_type; WCRT_With_Memory_Interferences : in Memory_Interference_Computation_Approach_Type := No_Memory_Interference; With_CRPD : in CRPD_Computation_Approach_Type := No_CRPD; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Rt : Response_Time_Table; Msg : Unbounded_String := empty_string; Missed : Boolean := False; a_scheduler : generic_scheduler_ptr; preemptive : Unbounded_String := empty_string; begin Put_Debug ("Call Compute_Feasibility_Response_Time"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; if Output /= Xml2_Output then Result := Result & unbounded_lf & Lb_Feasibility_Number2 (Current_Language) & unbounded_lf & unbounded_lf; end if; case a_transaction is when periodic => a_scheduler:=build_a_scheduler(A_Processor); Compute_Response_Time ( a_scheduler, Sys, A_Processor.name, Msg, Rt, WCRT_With_Memory_Interferences, With_CRPD ); free(a_scheduler); when Tindell => Tindell_Compute_Offset_Response_Time(sys.task_groups, a_processor.name, msg, rt); when Audsley => Audsley_Compute_Offset_Response_Time(sys.task_groups, a_processor.name, msg, rt); when Palencia => Palencia_Compute_Offset_Response_Time(sys.task_groups, a_processor.name, msg, rt); when Wcdops_plus => WCDOPS_Plus (sys, msg, rt, false); when Wcdops_plus_nim => WCDOPS_Plus_NIMp (sys, msg, rt, false); end case; if Output /= Xml2_Output then Result := Result & Start_Line & Lb_Minus & Lb_worst_case_Task_Response_Time (Current_Language) & Lb_Colon & Start_Ref & Msg & End_Ref & unbounded_lf; end if; for I in 0 .. Response_Time_Range (Get_Number_Of_Task_From_Processor (Sys.Tasks, A_Processor.name) - 1) loop if (Rt.entries (I).item /= null) then if Output /= Xml2_Output then Result := Result & Start_Task & To_Unbounded_String (" ") & Rt.entries (I).item.name & To_Unbounded_String (" =>") & Integer'Image (Integer (Rt.entries (I).data)) & End_Task; else Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Elli_Response_Time (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & Rt.entries (I).item.name & To_Unbounded_String ("""") & To_Unbounded_String (" value=""") & format (Rt.entries (I).data) & To_Unbounded_String (""" biblio=") & To_Unbounded_String ("""""/>"); end if; if (Natural (Rt.entries (I).data) > Rt.entries (I).item.deadline) then if Output /= Xml2_Output then Result := Result & Lb_Comma & Lb_Check_Deadline (Current_Language) & Rt.entries (I).item.deadline'Img & To_Unbounded_String (")"); end if; Missed := True; end if; Result := Result & unbounded_lf; end if; end loop; if Output = Xml2_Output then a_scheduler:=build_a_scheduler(A_Processor); if Get_Preemptive (A_Scheduler.all) = "PREEMPTIVE" then preemptive := To_Unbounded_String ("true"); else preemptive := To_Unbounded_String ("false"); end if; Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""") & Get_Name (A_Scheduler.all) & To_Unbounded_String ("""") & To_Unbounded_String (" preemptive=""") & preemptive & To_Unbounded_String (""""); end if; if Missed = False then if Output /= Xml2_Output then Result := Result & Lb_No_Deadline_Will_Be_Missed_Task_Are_Schedulable ( Current_Language); else Result := Result & To_Unbounded_String (" result=""true""") & To_Unbounded_String (" explanation=""") & Lb_No_Deadline_Will_Be_Missed_Task_Are_Schedulable ( Current_Language) & To_Unbounded_String (""""); end if; else if Output /= Xml2_Output then Result := Result & Lb_Deadline_Will_Be_Missed_Task_Are_Not_Schedulable ( Current_Language); else Result := Result & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Deadline_Will_Be_Missed_Task_Are_Not_Schedulable ( Current_Language) & To_Unbounded_String (""""); end if; end if; if Output /= Xml2_Output then Result := Result & End_Line & unbounded_lf & End_Sched_Feas & unbounded_lf; else Result := Result & To_Unbounded_String (" bilbio=""""/>") & unbounded_lf; end if; exception when Task_Set.Task_Must_Have_Period_Equal_To_Deadline => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_4 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_4 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Task_Set.Task_Must_Be_Periodic => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_5 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_5 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Task_Set.Task_Model_Error => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_6 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_6 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Processor_Utilization_Exceeded => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_7 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_7 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Task_Set.Start_Time_Error => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_12 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_12 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Task_Set.Offset_Error => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_13 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_13 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Invalid_Scheduler => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_18 (Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_18 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when computation_time_exceeded => if Output /= Xml2_Output then Result := Result & lb_computation_time_exceeded(Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & lb_computation_time_exceeded (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when transaction_error => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_25(Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_25 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when task_set.generic_task_set.empty_set => if Output /= Xml2_Output then Result := Result & Lb_Compute_Scheduling_Error_26(Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Compute_Scheduling_Error_26 (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Cache_Access_Profile_Must_Be_Defined => if Output /= Xml2_Output then Result := Result & Lb_Cache_Access_Profile_Must_Be_Defined(Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Cache_Access_Profile_Must_Be_Defined (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; when Cache_Access_Profile_Must_Be_Defined_For_All_Tasks => if Output /= Xml2_Output then Result:= Result & Lb_Cache_Access_Profile_Must_Be_Defined(Current_Language) & unbounded_lf; else Result := Result & Elli_Schedulability & To_Unbounded_String (" scheduler=""""") & To_Unbounded_String (" preemptive=""""") & To_Unbounded_String (" result=""false""") & To_Unbounded_String (" explanation=""") & Lb_Cache_Access_Profile_Must_Be_Defined (Current_Language) & To_Unbounded_String (""" bilbio=""""/>") & unbounded_lf; end if; end Compute_Feasibility_Response_Time; procedure Set_Priorities (Sys : in out System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; A_Scheduler : in Framework_Statement_Type; Output : in Output_Format := String_Output) is Ok : Boolean := True; error_msg : unbounded_string; A_Task : Generic_Task_Ptr; My_Task_Iterator : Tasks_Iterator; begin Put_Debug ("Call Set_Priorities"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; if Output = Xml2_Output then Result := Result & Elli_Feasibility_Test & To_Unbounded_String (" name="""); if (A_Scheduler = Scheduling_Set_Priorities_According_To_Rate_Monotonic) then Result := Result & Lb_Set_Priorities_Rm (Current_Language); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_Deadline_Monotonic) then Result := Result & Lb_Set_Priorities_Dm (Current_Language); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_Audsley_OPA) then Result := Result & Lb_Set_Priorities_Audsley_OPA (Current_Language); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT) then Result := Result & Lb_Set_Priorities_OPA_CRPD_PT (Current_Language); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT_Simplified) then Result := Result & Lb_Set_Priorities_OPA_CRPD_PT_Simplified (Current_Language); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_Tree) then Result := Result & Lb_Set_Priorities_OPA_CRPD_Tree (Current_Language); else Result := Result & Lb_Elli_Unknown_Sched (Current_Language); end if; Result := Result & To_Unbounded_String (""" reference=""") & A_Processor.name & To_Unbounded_String (""">") & unbounded_lf; end if; begin if (A_Scheduler = Scheduling_Set_Priorities_According_To_Rate_Monotonic) then Set_Priority_According_To_Rm (Sys.Tasks, A_Processor.name); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_Deadline_Monotonic) then Set_Priority_According_To_Dm (Sys.Tasks, A_Processor.name); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_Audsley_OPA) then Set_Priority_According_To_Audsley_OPA(Sys.Tasks, A_Processor.name); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT_Simplified) then Set_Priority_According_To_CPA(Sys.Tasks, Sys.Cache_Access_Profiles, PT_Simplified, A_Processor.name); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT) then Set_Priority_According_To_CPA(Sys.Tasks, Sys.Cache_Access_Profiles, PT_Binomial_Coefficient, A_Processor.name); elsif (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_Tree) then Set_Priority_According_To_CPA(Sys.Tasks, Sys.Cache_Access_Profiles, Tree, A_Processor.name); end if; exception when Task_Set.Task_Must_Be_Periodic => Ok := False; error_msg:=Lb_priorities_error1(current_language); when Generic_Task_Set.empty_set => Ok := False; error_msg:=Lb_priorities_error2(current_language); when NO_FEASIBLE_PRIORITY_ASSIGNMENT_EXCEPTION => Ok := False; error_msg:=Lb_Priorities_Error_OPA(current_language); when NO_FEASIBLE_PRIORITY_ASSIGNMENT_WITH_CRPD_EXCEPTION => Ok := False; error_msg:=Lb_Priorities_Error_OPA_CRPD(current_language); when Offset_Must_Be_Defined => Ok := False; error_msg:=Lb_Offset_Must_Be_Defined_For_OPA(current_language); when Cache_Access_Profile_Not_Found => Ok := False; error_msg:=Lb_Cache_Access_Profile_Must_Be_Defined_For_OPA(current_language); when Cache_Access_Profile_Must_Be_Defined => Ok := False; error_msg:=Lb_Cache_Access_Profile_Must_Be_Defined_For_OPA(Current_Language); end; if Ok then if Output /= Xml2_Output then if (A_Scheduler = Scheduling_Set_Priorities_According_To_Rate_Monotonic) then Result := Result & Start_Line & Lb_Set_Priorities_Rm (Current_Language) & End_Line; end if; if (A_Scheduler = Scheduling_Set_Priorities_According_To_Deadline_Monotonic) then Result := Result & Start_Line & Lb_Set_Priorities_Dm (Current_Language) & End_Line; end if; if (A_Scheduler = Scheduling_Set_Priorities_According_To_Audsley_OPA) then Result := Result & Start_Line & Lb_Set_Priorities_Audsley_OPA (Current_Language) & End_Line; end if; if (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT) then Result := Result & Start_Line & Lb_Set_Priorities_OPA_CRPD_PT (Current_Language) & End_Line; end if; if (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT_Simplified) then Result := Result & Start_Line & Lb_Set_Priorities_OPA_CRPD_PT_Simplified (Current_Language) & End_Line; end if; if (A_Scheduler = Scheduling_Set_Priorities_According_To_OPA_CRPD_Tree) then Result := Result & Start_Line & Lb_Set_Priorities_OPA_CRPD_Tree (Current_Language) & End_Line; end if; Result := Result & unbounded_lf & Start_Line & Lb_Priorities (Current_Language); end if; reset_iterator (Sys.Tasks, My_Task_Iterator); loop current_element (Sys.Tasks, A_Task, My_Task_Iterator); if (A_Task.cpu_name = A_Processor.name) then if Output /= Xml2_Output then Result := Result & unbounded_lf & Start_Task & To_Unbounded_String (" ") & A_Task.name & To_Unbounded_String (" =>") & To_Unbounded_String (A_Task.priority'Img) & End_Task; else Result := Result & Elli_Computation & To_Unbounded_String (" name=") & To_Unbounded_String ("""") & Lb_Priorities (Current_Language) & To_Unbounded_String ("""") & To_Unbounded_String (" reference=") & To_Unbounded_String ("""") & A_Task.name & To_Unbounded_String ("""") & To_Unbounded_String (" value=""") & To_Unbounded_String (A_Task.priority'Img) & To_Unbounded_String (""" biblio=") & To_Unbounded_String ("""""/>") & unbounded_lf; end if; end if; exit when is_last_element (Sys.Tasks, My_Task_Iterator); next_element (Sys.Tasks, My_Task_Iterator); end loop; if Output /= Xml2_Output then Result := Result & unbounded_lf & End_Line & unbounded_lf & End_Set_Prio; else Result := Result & Elli_Close_Feasibility_Test; end if; else if Output /= Xml2_Output then Result := Result & error_msg; else --Result := --Result & --Elli_Computation & --To_Unbounded_String (" name=") & --To_Unbounded_String ("""") & --Lb_Priorities (Current_Language) & --To_Unbounded_String ("""") & --To_Unbounded_String (" reference=") & --To_Unbounded_String ("""all""") & --To_Unbounded_String (" value=") & --To_Unbounded_String ("""NA""") & --To_Unbounded_String (" explanation=""") & --error_msg & --To_Unbounded_String ("""") & --To_Unbounded_String (" biblio=") & --To_Unbounded_String ("""""/>") & --unbounded_lf; Result := Result & To_Unbounded_String ("") & unbounded_lf; Result := Result & Elli_Close_Feasibility_Test; end if; end if; end Set_Priorities; procedure Run_User_Defined_Event_Handlers (Sys : in System; Result : in out Unbounded_String; Output : in Output_Format := String_Output) is Msg : Unbounded_String; My_Iterator : Event_Analyzers_Iterator; An_Event_Analyzer : Event_Analyzer_Ptr; begin Put_Debug ("Call Run_User_Defined_Event_Handlers"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; if (get_number_of_elements (Sys.Event_Analyzers) > 0) then reset_iterator (Sys.Event_Analyzers, My_Iterator); loop current_element (Sys.Event_Analyzers, An_Event_Analyzer, My_Iterator); -- Run an event analyzer --- begin Msg := empty_string; Result := Result & unbounded_lf & unbounded_lf; Result := Result & Lb_Minus & Lb_Event_Analyzer_Name (Current_Language) & Lb_Colon & An_Event_Analyzer.event_analyzer_source_file_name & unbounded_lf & unbounded_lf; Run_An_Event_Analyzer (Sys, Sched, An_Event_Analyzer, Msg); Result := Result & Msg; Result := Result & unbounded_lf & unbounded_lf; exception when Parametric_File_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Parametric_File_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Type_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Type_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Statement_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Statement_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Variable_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Variable_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; when Syntax_Error => Result := Result & Lb_Minus & Lb_Simulation_Error (Current_Language) & Lb_Syntax_Error (Current_Language) & Lb_Comma & Exception_Message & unbounded_lf; end; exit when is_last_element (Sys.Event_Analyzers, My_Iterator); next_element (Sys.Event_Analyzers, My_Iterator); end loop; end if; end Run_User_Defined_Event_Handlers; procedure Partionning_Tasks (Sys : in out System; Result : in out Unbounded_String; A_Parition_Rule : in Partioning_Type; Output : in Output_Format := String_Output) is Partitionned_Task_Set : Tasks_Set; A_Task : Generic_Task_Ptr; My_Task_Iterator : Tasks_Iterator; Msg : Unbounded_String := empty_string; begin Put_Debug ("Call Partionning_Tasks"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; case A_Parition_Rule is when General_Task => Partition_General_Task (Sys.Processors, Sys.Tasks, Msg, Partitionned_Task_Set); when Best_Fit => Partition_Best_Fit (Sys.Processors, Sys.Tasks, Msg, Partitionned_Task_Set); when Next_Fit => Partition_Next_Fit (Sys.Processors, Sys.Tasks, Msg, Partitionned_Task_Set); when First_Fit => Partition_First_Fit (Sys.Processors, Sys.Tasks, Msg, Partitionned_Task_Set); when Small_Task => Partition_Small_Task (Sys.Processors, Sys.Tasks, Msg, Partitionned_Task_Set); end case; if Output = Xml_Output then Result := Result & Start_Line & Lb_Minus & Lb_Partitioning_Result (Current_Language) & Start_Ref & Msg & End_Ref & Lb_Colon & unbounded_lf; end if; Sys.Tasks := Partitionned_Task_Set; reset_iterator (Sys.Tasks, My_Task_Iterator); loop current_element (Sys.Tasks, A_Task, My_Task_Iterator); if Output = Xml_Output then Result := Result & unbounded_lf & To_Unbounded_String (" ") & A_Task.name & To_Unbounded_String (" =>") & A_Task.cpu_name; elsif Output = Xml2_Output then Result := Result & To_Unbounded_String (" ") & To_Unbounded_String ("") & unbounded_lf; end if; exit when is_last_element (Sys.Tasks, My_Task_Iterator); next_element (Sys.Tasks, My_Task_Iterator); end loop; if Output = Xml_Output then Result := Result & unbounded_lf & unbounded_lf; end if; exception when Processors_Should_Have_The_Same_Scheduler => if Output = Xml_Output then Result := Result & Lb_Partition_Error1 (Current_Language); elsif Output = Xml2_Output then Result := Result & To_Unbounded_String (""); end if; when No_Such_Processors => if Output = Xml_Output then Result := Result & Lb_Partition_Error2 (Current_Language); elsif Output = Xml2_Output then Result := Result & To_Unbounded_String (""); end if; when Invalid_Scheduler_Multiprocessors => if Output = Xml_Output then Result := Result & Lb_Partition_Error3 (Current_Language); elsif Output = Xml2_Output then Result := Result & To_Unbounded_String (""); end if; when Task_Set.Task_Must_Be_Periodic => if Output = Xml_Output then Result := Result & Lb_Partition_Error4 (Current_Language); elsif Output = Xml2_Output then Result := Result & To_Unbounded_String (""); end if; end Partionning_Tasks; procedure Compute_Feasibility_Basics (Sys : in out System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is begin Put_Debug ("Call Compute_Feasibility_Basics"); if Output = Xml2_Output then Result := Result & Elli_Feasibility_Test & To_Unbounded_String (" name=""") & Lb_Elli_Utilization_Factor (Current_Language) & To_Unbounded_String (""" reference=""") & A_Processor.name & To_Unbounded_String (""">") & unbounded_lf; end if; Compute_Feasibility_Processor_Utilization_Factor (Sys, Result, A_Processor, Output); if Output = Xml2_Output then Result := Result & Elli_Close_Feasibility_Test & unbounded_lf; Result := Result & Elli_Feasibility_Test & To_Unbounded_String (" name=""") & Lb_Elli_Worst_Case_Response_Time (Current_Language) & To_Unbounded_String (""" reference=""") & A_Processor.name & To_Unbounded_String (""">") & unbounded_lf; end if; Compute_Feasibility_Response_Time (Sys, Result, periodic, No_Memory_Interference, No_CRPD, A_Processor, Output); if Output = Xml2_Output then Result := Result & Elli_Close_Feasibility_Test; end if; end Compute_Feasibility_Basics; ------------------------------------------------------------------------ -- Compute_Feasibility_By_Demand_Bound_Function -- "Preemptively Scheduling Hard-Real-Time Sporadic Tasks on One processor", -- Baruah, Mok and Rosier, 1990 -- Implementation Notes: -- S. Rubini, 11/2018 ------------------------------------------------------------------------ procedure Compute_Feasibility_By_Demand_Bound_Function (Sys : in System; Result : in out Unbounded_String; A_Processor : in Generic_Processor_Ptr; Output : in Output_Format := String_Output) is Compute_Report : Feasibility_Test.Processor_Demand.Feasibility_Test_Report; A_Scheduler : Generic_Scheduler_Ptr; begin Put_Debug ("Call Compute_Feasibility_By_Demand_Bound_Function"); if Output = Xml_Output then Set_Tag; else Set_Empty; end if; Result := Result & Lb_Feasibility_Dbf (Current_Language) & unbounded_lf & unbounded_lf; A_Scheduler:=Build_A_Scheduler(A_Processor); begin Sporadic_Periodic_Task_Set_Feasibility_Test(A_Scheduler, Sys.Tasks, A_Processor.Name, Compute_Report); -- report results if Compute_Report.Feasible then if Compute_Report.Motivation=By_Processor_Utilization_Factor then Result := Result & Start_Line & Lb_Sched_Explanation1 (Current_Language) & Lb_Sched_Explanation12 (Current_Language) & Start_Fact_Bound & format (Compute_Report.Processor_Utilization_Bound) & End_Fact_Bound & Start_Ref & To_Unbounded_String (" (") & Lb_See (Current_Language) & To_Unbounded_String ("[1], page 6). ") & End_Ref & End_Line & unbounded_lf & Start_Line & Lb_Utilization_With_Period (Current_Language) & Start_Deadl_Fact & format (Compute_Report.Processor_Utilization) & End_Deadl_Fact & End_Line & unbounded_lf & unbounded_lf ; elsif Compute_Report.Motivation=By_Dbf then Result := Result & Start_Line & Lb_Sched_Explanation_dbf1 (Current_Language) & Start_Fact_Bound & Compute_Report.Check_Interval'Img & Start_Ref & To_Unbounded_String (" (") & Lb_See (Current_Language) & To_Unbounded_String ("[22], page 6). ") & End_Ref & End_Line & unbounded_lf ; else null; -- TODO raise an exception end if; else -- unfeasible if Compute_Report.Motivation=By_Processor_Utilization_Factor then Result := Result & Lb_Sched_Explanation2 (Current_Language) & Lb_Sched_Explanation22 (Current_Language) & Start_Fact_Bound & format (Compute_Report.Processor_Utilization_Bound) & End_Fact_Bound & Start_Ref & To_Unbounded_String (" (") & Lb_See (Current_Language) & To_Unbounded_String ("[1], page 6). ") & End_Ref & End_Line & unbounded_lf & Start_Line & Lb_Utilization_With_Period (Current_Language) & Start_Fact_Bound & format (Compute_Report.Processor_Utilization) & End_Fact_Bound & End_Line & unbounded_lf ; elsif Compute_Report.Motivation=By_Dbf then -- Compute_Report.Overrun_Time /= 0 Result := Result & Lb_Sched_Explanation_dbf2 (Current_Language) & Start_Fact_Bound & Compute_Report.Check_Interval'Img & End_Fact_Bound & Start_Ref & To_Unbounded_String (" (") & Lb_See (Current_Language) & To_Unbounded_String ("[22], page ?). ") & End_Ref & End_Line & unbounded_lf & Start_Line & Lb_Minus & Lb_Feasibility_Dbf_Check_Interval (Current_Language) & Start_Fact_Bound & Compute_Report.Check_Interval'Img & End_Fact_Bound & unbounded_lf & End_Line & Start_Line & Lb_Minus & Lb_Feasibility_Dbf_Overrun_Instant (Current_Language) & Start_Deadl_Fact & Compute_Report.Overrun_Time'Img & End_Deadl_Fact & End_Line & Start_Line & unbounded_lf ; else null; end if; end if; exception when Task_Set.Task_Must_Be_Sporadic_Or_Periodic => Result := Result & Lb_Compute_Scheduling_Error_27 (Current_Language) & unbounded_lf; when Invalid_Scheduler => Result := Result & Lb_Compute_Scheduling_Error_18 (Current_Language) & unbounded_lf; end; end Compute_Feasibility_By_Demand_Bound_Function; end Call_Scheduling_Framework;