------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real time scheduling analysis tool. -- This program provides services to automatically check performances -- of real time architectures. -- -- Copyright (C) 2002-2010, by Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- the LISyC Team, University of Western Britanny. -- -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- 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: 523 $ -- $Date: 2012-09-26 15:09:39 +0200 (Wed, 26 Sep 2012) $ -- $Author: fotsing $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Xml_Tag; use Xml_Tag; with double_util; use double_util; with Translate; use Translate; with unbounded_strings; use unbounded_strings; with feasibility_test.processor_utilization; use feasibility_test.processor_utilization; package body Scheduler.Dynamic_Priority.Muf is procedure Utilization_Factor_Feasibility_Test (My_Scheduler : in Muf_Scheduler; My_Tasks : in Tasks_Set; Processor_Name : in Unbounded_String; Result : in out Unbounded_String; Output : in Output_Format := String_Output) is Tmp : Tasks_Set; Bound : Double := 0.0; Utildi : Double := 0.0; Msg : Unbounded_String := empty_string; Verif : Boolean := True; A_Task : Generic_Task_Ptr; My_Task_Iterator : Tasks_Iterator; A_Task2 : Generic_Task_Ptr; My_Task_Iterator2 : Tasks_Iterator; Calcul : Double := 0.0; L_Debut : Natural; L_Dernier : Natural; Ech_Sur_Req : Boolean := True; Pbconstraints : Boolean := False; Msg2 : Unbounded_String := empty_string; Msg3 : Unbounded_String := empty_string; begin Start_Time_Control (My_Tasks, Processor_Name); Offset_Control (My_Tasks, Processor_Name); case Get_Preemptive (My_Scheduler) is when preemptive => Bound_On_Processor_Utilization (My_Scheduler, My_Tasks, Processor_Name, Bound, Msg); Utildi := Processor_Utilization_Over_Deadline (My_Tasks, Processor_Name); if Output /= Xml2_Output then Result := Result & Lb_Utilization_Bound1 (Current_Language); Result := Result & Lb_Muf (Current_Language); end if; if Utildi <= Bound then if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""true"" explanation="""); end if; Result := Result & Lb_Sched_Explanation1 (Current_Language); Result := Result & Start_Fact_Bound & format (Utildi) & End_Fact_Bound; Result := Result & Lb_Sched_Explanation12 (Current_Language); Result := Result & Start_Fact_Bound & format (Bound) & End_Fact_Bound; else if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); end if; Result := Result & Lb_Sched_Explanation2 (Current_Language); Result := Result & Start_Fact_Bound & format (Utildi) & End_Fact_Bound; Result := Result & Lb_Sched_Explanation22 (Current_Language); Result := Result & Start_Fact_Bound & format (Bound) & End_Fact_Bound; end if; if Output /= Xml2_Output then Result := Result & Start_Ref & Msg & End_Ref & unbounded_lf; else Result := Result & To_Unbounded_String (""" biblio=""") & Msg & To_Unbounded_String (""""); end if; when not_preemptive => Current_Processor_Name := Processor_Name; select_and_copy (My_Tasks, Tmp, Select_Cpu'Access); Msg2 := empty_string; --Check if the system is in stricts constraints --The test works only on stricts constraints ! -- reset_iterator (Tmp, My_Task_Iterator); loop current_element (Tmp, A_Task, My_Task_Iterator); if (A_Task.cpu_name = Processor_Name) then if (Periodic_Task_Ptr (A_Task).period /= A_Task.deadline) then Ech_Sur_Req := False; end if; end if; exit when is_last_element (Tmp, My_Task_Iterator); next_element (Tmp, My_Task_Iterator); end loop; sort (Tmp, Increasing_Deadline'Access); reset_iterator (Tmp, My_Task_Iterator); current_element (Tmp, A_Task, My_Task_Iterator); L_Debut := Periodic_Task_Ptr (A_Task).period + 1; Verif := True; -- Main loop of all tasks -- if Ech_Sur_Req then if Output /= Xml2_Output then Result := Result & Lb_Utilization_Bound11 (Current_Language) & Lb_Muf (Current_Language); end if; loop Msg3 := empty_string; if (A_Task.cpu_name = Processor_Name) then L_Dernier := Periodic_Task_Ptr (A_Task).period - 1; for L_Courant in L_Debut .. L_Dernier loop reset_iterator (Tmp, My_Task_Iterator2); -- Second loop until the current task -- Calcul := 0.0; loop current_element (Tmp, A_Task2, My_Task_Iterator2); exit when A_Task.name = A_Task2.name; Calcul := Calcul + Double ((Integer ((L_Courant - 1) / Periodic_Task_Ptr ( A_Task2).period)) * A_Task2.capacity); next_element (Tmp, My_Task_Iterator2); end loop; -- Checking -- Calcul := Calcul + Double (A_Task.capacity); if Calcul > Double (L_Courant) then Verif := False; Msg3 := A_Task.name & " "; end if; end loop; end if; Msg2 := Msg2 & Msg3; exit when is_last_element (Tmp, My_Task_Iterator); next_element (Tmp, My_Task_Iterator); current_element (Tmp, A_Task, My_Task_Iterator); end loop; else if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); Result := Result & Lb_Pb_Strict_Constraints (Current_Language); Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String (""""); else Result := Result & To_Unbounded_String ("- ") & Lb_Pb_Strict_Constraints (Current_Language) & unbounded_lf; end if; Pbconstraints := True; end if; -- Checks the result -- if Pbconstraints = False then if Verif then if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""true"" explanation="""); end if; Result := Result & Lb_Sched_Explanation5 (Current_Language); Result := Result & Lb_Sched_Explanation52 (Current_Language); if Output = Xml2_Output then Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("[8]") & To_Unbounded_String (""""); else Result := Result & To_Unbounded_String (" (") & Lb_See (Current_Language) & "[8].)" & unbounded_lf; end if; else if Output = Xml2_Output then Result := Result & To_Unbounded_String (" result=""false"" explanation="""); end if; Result := Result & Lb_Sched_Explanation6 (Current_Language); Result := Result & Lb_Sched_Explanation62 (Current_Language) & Lb_Sched_Explanation7 (Current_Language) & Msg2; if Output = Xml2_Output then Result := Result & To_Unbounded_String (""" biblio=""") & To_Unbounded_String ("[8]") & To_Unbounded_String (""""); else Result := Result & To_Unbounded_String (" (") & Lb_See (Current_Language) & "[8])."; end if; end if; end if; end case; end Utilization_Factor_Feasibility_Test; end Scheduler.Dynamic_Priority.Muf;