------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2016, Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285 laboratory, Université 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: 1249 $ -- $Date: 2014-08-28 07:02:15 +0200 (Fri, 28 Aug 2014) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Numerics.Aux; use Ada.Numerics.Aux; with Text_IO; use Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO.Unbounded_IO; with Framework_Config; use Framework_Config; with Processor_Set; use Processor_Set; use Processor_Set.Generic_Processor_Set; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with unbounded_strings; use unbounded_strings; use unbounded_strings.strings_table_package; use unbounded_strings.unbounded_string_list_package; with Parameters; use Parameters; with Parameters.extended; use Parameters.extended; use Parameters.Framework_Parameters_Table_Package; with Scheduling_Analysis; use Scheduling_Analysis.Double_Tasks_Parameters_Package; with Scheduler_Interface; use Scheduler_Interface; with Processor_Set; use Processor_Set; use Processor_Set.Generic_Processor_Set; with Processors; use Processors; with processor_interface; use processor_interface; with Caches; use Caches; use Caches.Caches_Table_Package; with Core_Units; use Core_Units; use Core_Units.Core_Units_Table_Package; with Address_Space_Set; use Address_Space_Set; use Address_Space_Set.Generic_Address_Space_Set; with Task_Set; use Task_Set; use Task_Set.Generic_Task_Set; with Offsets; use Offsets; with Systems; use Systems; with Call_Framework; use Call_Framework; with Call_Framework_Interface; use Call_Framework_Interface; use Call_Framework_Interface.Framework_Response_Package; use Call_Framework_Interface.Framework_Request_Package; with framework; use framework; with Call_Scheduling_Framework; use Call_Scheduling_Framework; with Multiprocessor_Services; use Multiprocessor_Services; with Multiprocessor_Services_Interface; use Multiprocessor_Services_Interface; use Multiprocessor_Services_Interface.Scheduling_Result_Per_Processor_Package; with Feasibility_Test.transaction_Worst_Case_Response_Time; use Feasibility_Test.transaction_Worst_Case_Response_Time; with Scheduling_Analysis; use Scheduling_Analysis; with GNAT.Command_Line; with GNAT.OS_Lib; use GNAT.OS_Lib; with Version; use Version; with Ada.Exceptions; use Ada.Exceptions; with GNAT.Traceback.Symbolic; with Task_Groups; use Task_Groups; with Task_Group_Set; use Task_Group_Set; with Tasks; use Tasks; with Task_Dependencies; use Task_Dependencies; with Dependencies; use Dependencies; with architecture_factory; use architecture_factory; with Task_Group_Transformation; use Task_Group_Transformation; with Comprehensive_Call; procedure WCDOPS_P_NIM is procedure Usage is begin Put_Line( "This program reads a Cheddar XML with tree-shaped transactions. It computes response time upper-bounds for tasks in the system and print them in a file." ); New_Line; Put_Line ("Usage : wcdops_nim [options] "); Put_Line (" [options] :"); Put_Line (" -h This message"); Put_Line (" -v Verbose mode"); Put_Line (" -o : String"); New_Line; end Usage; Sys_Transaction : System; Project_File_List : unbounded_string_list; Project_File_Dir_List : unbounded_string_list; Response_Times : Response_Time_Table; Msg : Unbounded_String; Output_File_Name : Unbounded_String := empty_string; Input_File_Name : Unbounded_String := empty_string; F : Ada.Text_IO.File_Type; Verbose : Boolean := False; No_Error : Boolean := False; Stop_On_Deadline_Missed : Boolean := False; begin -- Get arguments loop case GNAT.Command_Line.Getopt ("h v s o:") is when ASCII.NUL => No_Error := True; exit; when 'o' => Output_File_Name := To_Unbounded_String (GNAT.Command_Line.Parameter); when 's' => Stop_On_Deadline_Missed := True; when 'v' => Verbose := True; when 'h' => Usage; OS_Exit (0); when others => Usage; OS_Exit (0); end case; end loop; if not No_Error then Put_Line ("Error in provided options! Please verify their values."); OS_Exit (1); end if; loop declare S : constant String := GNAT.Command_Line.Get_Argument (Do_Expansion => True); begin exit when S'Length = 0; Input_File_Name := Input_File_Name & S; end; end loop; if Input_File_Name = empty_string then Put_Line ("XML file must be provided empty!"); Usage; OS_Exit (0); end if; Call_Framework.initialize (False); initialize (Project_File_List); if Verbose then Put_Line ("Reading XML file..."); end if; Systems.Read_From_Xml_File (Sys_Transaction, Project_File_Dir_List, Input_File_Name); if Verbose then Put_Line ("Calling WCDOPS+_NIM test..."); end if; WCDOPS_Plus_NIMP (Sys_Transaction, Msg, Response_Times, Stop_On_Deadline_Missed); if Verbose then Put_Line ("Exporting results..."); end if; if Output_File_Name /= empty_string then Create (F, Mode => Out_File, Name => To_String (Output_File_Name)); for i in 0 .. Response_Times.nb_entries - 1 loop Unbounded_IO.Put_Line (F, Response_Times.entries (i).item.name & " " & suppress_space ("(" & Periodic_Task_Ptr (Response_Times.entries (i).item).jitter'Img) & ") = " & Integer (Response_Times.entries (i).data)'Img); Unbounded_IO.Put_Line (F, To_Unbounded_String ("=============")); if Verbose then Put_Line (To_String (Response_Times.entries (i).item.name) & " " & To_String (suppress_space ("(" & Periodic_Task_Ptr (Response_Times.entries (i).item). jitter'Img)) & ") = " & Integer (Response_Times.entries (i).data)'Img); Put_Line ("============="); end if; end loop; Close (F); else for i in 0 .. Response_Times.nb_entries - 1 loop Put_Line (To_String (Response_Times.entries (i).item.name) & " " & To_String (suppress_space ("(" & Periodic_Task_Ptr (Response_Times.entries (i).item).jitter' Img)) & ") = " & Integer (Response_Times.entries (i).data)'Img); Put_Line ("============="); end loop; end if; if Verbose then Put_Line ("All done!"); end if; end WCDOPS_P_NIM;