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 generic_package_widget; use 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 initialize (Response_List); initialize (Request_List); if Preemption_From_Simulation then Initialize (A_Request); A_Request.target := Name; A_Request.statement := Scheduling_Simulation_Preemption_Number; add (Request_List, A_Request); end if; if Context_Switch_From_Simulation then Initialize (A_Request); A_Request.target := Name; A_Request.statement := Scheduling_Simulation_Context_Switch_Number; add (Request_List, A_Request); 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 (A_Request); 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); 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 (A_Request); 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); end if; Sequential_Framework_Request (Sys, Request_List, Response_List); --Write_Title --(Event_Table_Analysis.Text, -- Response_List.entries (0).title); Write_Title (Response_List); for J in 0 .. Response_List.nb_entries - 1 loop -- Write_Text -- (Event_Table_Analysis.Text, --Response_List.entries (J).text); Write_Text (Response_List); end loop; end Call_Processor_Analysis; procedure Show_Scheduling_Simulation(Object : access Gtkada_Builder_Record'Class) is --Builder : Gtkada_Builder; --Error : Glib.Error.GError; A_Processor : Generic_Processor_Ptr; My_Processor_Iterator : Processors_Iterator; Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; -- Cpu_Index : Gint; 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"))); --Cpu_Index := -- Gint'Val -- (Gint (get_number_of_elements (Sys.Processors)) - -- Gint (Selected_Button -- (Event_Table_Analysis.Clist_Processor_Menu))); -- Cpu_Index := Cpu_Index - 1; -- get_element_number -- (Sys.Processors, -- A_Processor, -- Processors_Range (Cpu_Index)); -- Last_Selected_Processor := A_Processor.name; A_Processor := Search_Processor (Sys.Processors, to_Unbounded_String(Get_Active_Text(Gtk_Combo_Box(Get_Object(Object, "combobox1"))))); -- Call the framework now -- Initialize (A_Request); 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); A_Request.statement := Scheduling_Simulation_Run_Event_Handler; add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); --Write_Title_And_Text (Event_Table_Analysis.Text, Response_List); Write_Title_And_Text (Response_List); end if; --Destroy (Event_Table_Analysis); 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;