------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, 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 README.md -- -- 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: 3657 $ -- $Date: 2020-12-13 13:25:49 +0100 (dim., 13 déc. 2020) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Text_IO; 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 Gtk.Combo_Box_Text; use Gtk.Combo_Box_Text; with Glib; use Glib; with Glib.Object; use Glib.Object; with Gtk.Check_Button; use Gtk.Check_Button; with graphical_editor.processors; use graphical_editor.processors; with graphical_editor.generic_package_widget; use graphical_editor.generic_package_widget; with graphical_editor.event_analyzers; use graphical_editor.event_analyzers; with graphical_editor.user_message; use graphical_editor.user_message; with graphical_editor.message_text; use graphical_editor.message_text; 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 editor_config; use editor_config; 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; 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_processors := 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_text (Get_Object (object, "combobox1"))))); -- Call the framework now -- if schedule_all_processors = 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 (gtk_widget (my_widget)); Gtk.Main.Main_Quit; end close_widget; end graphical_editor.analysis_on_event_table_callbacks;