------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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: 4203 $ -- $Date: 2022-08-29 16:48:23 +0200 (lun., 29 août 2022) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; with Gtkada.Builder; use Gtkada.Builder; with Glib; use Glib; with Glib.Object; use Glib.Object; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Gtk.Drawing_Area; use Gtk.Drawing_Area; with Doubles; use Doubles; with editor_config; use editor_config; with framework_config; use framework_config; with translate; use translate; with time_unit_events; use time_unit_events; with framework; use framework; with multiprocessor_services_interface; use multiprocessor_services_interface; use multiprocessor_services_interface.scheduling_result_per_processor_package; with graphical_editor.user_message; use graphical_editor.user_message; with graphical_editor.draw_scheduling; use graphical_editor.draw_scheduling; with graphical_editor.scheduling_simulations_callbacks; use graphical_editor.scheduling_simulations_callbacks; with graphical_editor.generic_package_widget; use graphical_editor.generic_package_widget; package body graphical_editor.scheduling_option_callbacks is procedure ok (object : access gtkada_builder_record'class) is ok : Boolean; my_widget : gobject; textbuffer_string : Unbounded_String; begin if Get_Active (gtk_check_button (Get_Object (object, "checkbutton1"))) then schedule_with_offsets := True; else schedule_with_offsets := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton2"))) then schedule_with_precedencies := True; else schedule_with_precedencies := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton3"))) then schedule_with_resources := True; else schedule_with_resources := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton16"))) then is_global_predictable_seed := True; else is_global_predictable_seed := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton15"))) then has_global_seed := False; else has_global_seed := True; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton14"))) then draw_core_unit_time_line := True; else draw_core_unit_time_line := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton17"))) then draw_address_space_time_line := True; else draw_address_space_time_line := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton18"))) then several_colors_for_time_lines := True; else several_colors_for_time_lines := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton19"))) then display_wait_for_resource := True; else display_wait_for_resource := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton20"))) then display_task_activation := True; else display_task_activation := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton21"))) then display_allocate_resource := True; else display_allocate_resource := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton24"))) then display_release_resource := True; else display_release_resource := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton22"))) then display_address_space_activation := True; else display_address_space_activation := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton23"))) then display_address_space_completion := True; else display_address_space_completion := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton25"))) then schedule_with_jitters := True; else schedule_with_jitters := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton26"))) then minimize_preemption := True; else minimize_preemption := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "checkbutton27"))) then schedule_with_crpd := True; else schedule_with_crpd := False; end if; if Get_Active (gtk_check_button (Get_Object (object, "cbDiscardMissedDeadlines"))) then schedule_with_discard_missed_deadlines := True; else schedule_with_discard_missed_deadlines := False; end if; textbuffer_string := get_value_buffer_string (gtk_text_buffer (Get_Object (object, "textbuffer1"))); if textbuffer_string = "" then global_seed_value := 0; else to_integer (textbuffer_string, global_seed_value, ok); if not ok then show_message_box (lb_seed (current_language) & lb_must_be_numeric (current_language)); return; end if; end if; textbuffer_string := get_value_buffer_string (gtk_text_buffer (Get_Object (object, "textbuffer3"))); if textbuffer_string = "" then max_time_line_to_display := 0; else to_integer (textbuffer_string, max_time_line_to_display, ok); if not ok then show_message_box (lb_max_time_line_to_display (current_language) & lb_must_be_numeric (current_language)); return; end if; end if; textbuffer_string := get_value_buffer_string (gtk_text_buffer (Get_Object (object, "textbuffer2"))); if textbuffer_string = "" then time_line_between_time_axis := 0; else to_integer (textbuffer_string, time_line_between_time_axis, ok); if not ok then show_message_box (lb_time_line_between_time_axis (current_language) & lb_must_be_numeric (current_language)); return; end if; end if; for i in time_unit_event_type'range loop if (i /= task_activation) and (i /= running_task) and (i /= address_space_activation) and (i /= wait_for_memory) and (i /= discard_missed_deadline) and (i /= energy ) and (i /= mode_change) then if Get_Active (event_check_button (i)) then generate_events (i) := True; else generate_events (i) := False; end if; end if; end loop; my_widget := Get_Object (object, "window1"); Destroy (gtk_widget (my_widget)); Gtk.Main.Main_Quit; end ok; procedure cancel (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 cancel; procedure seed (object : access gtkada_builder_record'class) is seed : Generator; nmb : Natural; begin -- Give random value for the schedulers seed -- Reset (seed); -- range from natural'first .. natural'last nmb := abs (Integer (Double (Random (seed)) * Double (Natural'last - Natural'first) + Double (Natural'first))); Set_Text (gtk_text_buffer (Get_Object (object, "textbuffer1")), nmb'img); end seed; end graphical_editor.scheduling_option_callbacks;