------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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 Gtk.Menu_Item; use Gtk.Menu_Item; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Glib.Error; use Glib.Error; with Gtk.Widget; use Gtk.Widget; with Gtk.Dialog; use Gtk.Dialog; with Gtk.About_Dialog; use Gtk.About_Dialog; with Gtk.Label; use Gtk.Label; with Gtk.Text_Buffer; use Gtk.Text_Buffer; with Gtk.Combo_box; use Gtk.Combo_box; with Ada.Text_IO; with Glib; use Glib; with Glib.Object; use Glib.Object; with graphical_editor.processors; use graphical_editor.processors; with Framework_Config; use Framework_Config; with Translate; use Translate; with Tasks; use Tasks; with Task_Set; use Task_Set; use Task_Set.Generic_Task_Set; with Processors; use Processors; with Processor_Set; use Processor_Set; use Processor_Set.Generic_Processor_Set; with graphical_editor.user_message; use graphical_editor.user_message; with Gtk.Check_Button; use Gtk.Check_Button; with editor_config; use editor_config; with graphical_editor.generic_package_widget; use graphical_editor.generic_package_widget; with graphical_editor.event_analyzers; use graphical_editor.event_analyzers; with feasibility_test.feasibility_interval; use feasibility_test.feasibility_interval; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with unbounded_strings; use unbounded_strings; use unbounded_strings.strings_table_package; with Call_Framework; use Call_Framework; with Call_Framework_Interface; use Call_Framework_Interface; use Call_Framework_Interface.Framework_Request_Package; use Call_Framework_Interface.Framework_Response_Package; with Parameters; use Parameters; with Parameters.extended; use Parameters.extended; use Parameters.Framework_Parameters_Table_Package; with graphical_editor.message_text; use graphical_editor.message_text; package body graphical_editor.analysis_on_event_table_callbacks is -- Now, call scheduling analysis for each processor -- procedure Call_Processor_Analysis (Name : Unbounded_String) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; A_Param : Parameter_Ptr; begin if Preemption_From_Simulation then initialize (Response_List); initialize (Request_List); Initialize (A_Request); Initialize (A_Request.param); A_Request.target := Name; A_Request.statement := Scheduling_Simulation_Preemption_Number; add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); Write_Title (Response_List); Write_Text (Response_List); end if; if Context_Switch_From_Simulation then initialize (Response_List); initialize (Request_List); Initialize (A_Request); Initialize (A_Request.param); A_Request.target := Name; A_Request.statement := Scheduling_Simulation_Context_Switch_Number; add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); Write_Title (Response_List); Write_Text (Response_List); end if; if (Response_Time_From_Simulation (Worst_Case) or Response_Time_From_Simulation (Best_Case) or Response_Time_From_Simulation (Average_Case) or Response_Time_From_Simulation (Plot_Case)) then initialize (Response_List); initialize (Request_List); Initialize (A_Request); Initialize (A_Request.param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("worst_case"); if Response_Time_From_Simulation (Worst_Case) then A_Param.boolean_value := True; else A_Param.boolean_value := False; end if; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("best_case"); if Response_Time_From_Simulation (Best_Case) then A_Param.boolean_value := True; else A_Param.boolean_value := False; end if; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("average_case"); if Response_Time_From_Simulation (Average_Case) then A_Param.boolean_value := True; else A_Param.boolean_value := False; end if; add (A_Request.param, A_Param); A_Request.target := Name; A_Request.statement := Scheduling_Simulation_Response_Time; add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); Write_Title (Response_List); Write_Text (Response_List); end if; if (Blocking_Time_From_Simulation (Worst_Case) or Blocking_Time_From_Simulation (Best_Case) or Blocking_Time_From_Simulation (Average_Case) or Blocking_Time_From_Simulation (Plot_Case)) then initialize (Response_List); initialize (Request_List); Initialize (A_Request); Initialize (A_Request.param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("worst_case"); if Blocking_Time_From_Simulation (Worst_Case) then A_Param.boolean_value := True; else A_Param.boolean_value := False; end if; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("best_case"); if Blocking_Time_From_Simulation (Best_Case) then A_Param.boolean_value := True; else A_Param.boolean_value := False; end if; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("average_case"); if Blocking_Time_From_Simulation (Average_Case) then A_Param.boolean_value := True; else A_Param.boolean_value := False; end if; add (A_Request.param, A_Param); A_Request.target := Name; A_Request.statement := Scheduling_Simulation_Blocking_Time; add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); Write_Title (Response_List); Write_Text (Response_List); end if; end Call_Processor_Analysis; procedure Show_Scheduling_Simulation(Object : access Gtkada_Builder_Record'Class) is A_Processor : Generic_Processor_Ptr; My_Processor_Iterator : Processors_Iterator; Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; begin -- Get customization provided by the user -- Context_Switch_From_Simulation := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton13"))); Preemption_From_Simulation := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton14"))); Run_Event_Analyzer_From_Simulation := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton10"))); Schedule_All_Processeurs := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton9"))); Blocking_Time_From_Simulation (Worst_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton2"))); Blocking_Time_From_Simulation (Best_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton4"))); Blocking_Time_From_Simulation (Average_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton6"))); Blocking_Time_From_Simulation (Plot_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton8"))); Response_Time_From_Simulation (Worst_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton1"))); Response_Time_From_Simulation (Best_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton3"))); Response_Time_From_Simulation (Average_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton5"))); Response_Time_From_Simulation (Plot_Case) := Get_Active (Gtk_Check_Button(Get_Object(Object, "checkbutton7"))); A_Processor := Search_Processor (Sys.Processors, to_Unbounded_String(Get_Active_Text(Gtk_Combo_Box(Get_Object(Object, "combobox1"))))); -- Call the framework now -- if Schedule_All_Processeurs = False then Call_Processor_Analysis (Last_Selected_Processor); else reset_iterator (Sys.Processors, My_Processor_Iterator); loop current_element (Sys.Processors, A_Processor, My_Processor_Iterator); Call_Processor_Analysis (A_Processor.name); exit when is_last_element (Sys.Processors, My_Processor_Iterator); next_element (Sys.Processors, My_Processor_Iterator); end loop; end if; -- Now run, event analyzers, -- if Run_Event_Analyzer_From_Simulation then initialize (Response_List); initialize (Request_List); Initialize (A_Request); Initialize (A_Request.param); A_Request.statement := Scheduling_Simulation_Run_Event_Handler; add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); Write_Title (Response_List); Write_Text (Response_List); end if; graphical_editor.analysis_on_event_table_callbacks.close_widget(Object); end Show_Scheduling_Simulation; procedure Close_Widget(Object : access Gtkada_Builder_Record'Class) is my_widget : GObject; begin my_widget:=Get_Object(Object, "window1"); Destroy_cb(Gtk_Widget(my_widget)); gtk.main.main_quit; end Close_Widget; end graphical_editor.analysis_on_event_table_callbacks;