GUI

We provide on this page information to help developers understand the process of implementing GUI features in Cheddar.

Draw scheduling simulation

In this section, we explain the events from the click of the run simulation button to the draw of the simulation timeline.

  • GUI: run simulation button in cheddar.glade

    • Callback : on_toolbutton11_clicked() in cheddar.adb. This function shows the scheduling_simulation_draw.glade widget which then asks for the simulation period. This widget has two buttons OK and Cancel. The OK button is registered to the callback named read_scheduling_duration_and_draw_scheduling().
  • Simulation: the main entry point of the simulation process is read_scheduling_duration_and_draw_scheduling() in graphical_editor.scheduling_simulations_callbacks.adb. This function does the tasks below:

    • Compute the period to draw
    • Compute the period to run the simulation
    • Call the simulation (either call_customized_simulation() or call_uncustomized_simulation())
    • In call_customized_simulation, we call cheddar framework with parameters specified by the user (configurable in scheduling options widget), retrieve the responses and the computed event table. Then we proceed to draw the simulation timeline by calling draw_scheduling_events().
  • Drawing: the main entry point of the drawing process is draw_scheduling_events() in graphical_editor.draw_scheduling.adb

    • Drawing information is stored in a draw_scheduling_record. In a record, we have a system model, scheduling simulation parameters, an event table which is the result of the simulation, a Cairo Context, and sizes (width and height) of the canvas.
      type draw_scheduling_record is new gtk_widget_record with record
          tasks      : tasks_set;
          resources  : resources_set;
          messages   : messages_set;
          buffers    : buffers_set;
          processors : processors_set;
      
          period     : Natural;
          zoomed_period : Natural;
          start_draw : Natural;
      
          sched      : scheduling_table_ptr;
      
          Cr   : Cairo_Context;
      
          current_width  : gint;
          current_height : gint;
      end record;
      
  • The drawing is done on the widget drawing_area_cheddar in cheddar.glade. The binding between the widget and the Cairo_Context is done in the initialize() function.

        drawing_area_cheddar := gtk_drawing_area(Get_Object (builder, "drawing_area_cheddar"));
        graphical_editor.draw_scheduling.Initialize (graphical_editor.draw_scheduling.draw_scheduling);