------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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: 97 $ -- $Date: 2007-07-20 15:17:15 +0200 (Fri, 20 Jul 2007) $ -- $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;