diff --git a/glade/add-process-dialog.glade b/glade/add-process-dialog.glade index 838aad1..5248bdd 100644 --- a/glade/add-process-dialog.glade +++ b/glade/add-process-dialog.glade @@ -1,237 +1,180 @@ - - - + + + - - - Add Process - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_MOUSE - True - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - 3 - 2 - False - 11 - 9 - - - - True - Name - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - - - - - - - - True - Base Priority - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - - - - - - - - True - Arrival Time - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - - - - - - - - True - True - True - True - 0 - - True - - False - 17 - - - 1 - 2 - 0 - 1 - - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 0 0 65536 1 0 0 - - - 1 - 2 - 1 - 2 - - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 0 0 65536 1 0 0 - - - 1 - 2 - 2 - 3 - - - - - - 0 - True - True - - - - - - + + Add Process + False + True + GTK_WIN_POS_MOUSE + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + + + True + 6 + 4 + 2 + 9 + 11 + + + True + True + 1 1 65536 1 10 10 + + + 1 + 2 + 2 + 3 + + + + + + True + Duration + + + 2 + 3 + + + + + + True + True + 0 0 65536 1 0 0 + 1 + True + + + 1 + 2 + 3 + 4 + + + + + + True + True + 0 0 65536 1 0 0 + 1 + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + + 17 + + + 1 + 2 + + + + + + True + 0 + 0 + Arrival Time + + + 1 + 2 + + + + + + + True + 0 + 0 + Base Priority + + + 3 + 4 + + + + + + + True + 0 + 0 + Name + + + + + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + True + gtk-ok + True + -5 + + + + 1 + + + + + False + GTK_PACK_END + + + + + diff --git a/src/schedulables_tree_widget.cc b/src/schedulables_tree_widget.cc index 3dcb987..99f6456 100644 --- a/src/schedulables_tree_widget.cc +++ b/src/schedulables_tree_widget.cc @@ -316,29 +316,13 @@ SchedulablesTreeWidget::update(const History& history) TreeModel::Row rrow = *(_model->append(trow.children())); -// std::ostringstream oss; - // oss << _("request ") << ri + 1; + // std::ostringstream oss; + // oss << _("request ") << ri + 1; -// rrow[_main_column] = oss.str(); + // rrow[_main_column] = oss.str(); rrow[_types_column] = htype_request; rrow[_handles_column] = &r; -// vector subrequests = r.get_subrequests(); -// -// for(Iseq::iterator> srit = iseq(subrequests); srit; ++srit) -// { -// SubRequest& sr = *(*srit); -// -// TreeModel::Row srrow = *(_model->append(rrow.children())); -// -// // we are sure the key is valid, or no? -// const Environment& env = history.get_last_environment(); -// Resource& res = *(env.get_resources().find(sr.get_resource_key())->second); -// -// srrow[_main_column] = res.get_name(); -// srrow[_types_column] = htype_subrequest; -// srrow[_handles_column] = &sr; -// } } } } @@ -378,10 +362,12 @@ SchedulablesTreeWidget::add_edit_process(bool adding) Entry* name_entry; SpinButton* arrival_time_spin; + SpinButton* duration_spin; SpinButton* base_priority_spin; glade->get_widget("Name.Entry", name_entry); glade->get_widget("ArrivalTime.Spin", arrival_time_spin); + glade->get_widget("Duration.Spin", duration_spin); glade->get_widget("BasePriority.Spin", base_priority_spin); Process* selection = NULL; @@ -392,32 +378,35 @@ SchedulablesTreeWidget::add_edit_process(bool adding) name_entry->set_text(selection->get_name()); arrival_time_spin->set_value(static_cast(selection->get_arrival_time())); + duration_spin->set_value(static_cast(selection->get_total_cpu_time())); + duration_spin->set_sensitive(false); base_priority_spin->set_value(static_cast(selection->get_base_priority())); } -// else -// { -// name_entry->set_text(""); -// arrival_time_spin->set_value(0.0); -// base_priority_spin->set_value(0.0); -// } - if(add_process_dialog->run() == RESPONSE_OK) { - if(adding) - { - Simulation::get_instance().get_history().add_process(name_entry->get_text(), - arrival_time_spin->get_value_as_int(), - base_priority_spin->get_value_as_int()); - } + { + History& h = Simulation::get_instance().get_history(); + History::LockNotify lock(h); + + Process& np = h.add_process(name_entry->get_text(), + arrival_time_spin->get_value_as_int(), + base_priority_spin->get_value_as_int()); + + h.add_thread(_("Main"), np, duration_spin->get_value_as_int(), + 0, base_priority_spin->get_value_as_int()); + } else - { - Simulation::get_instance().get_history().edit_process(*selection, - name_entry->get_text(), - arrival_time_spin->get_value_as_int(), - base_priority_spin->get_value_as_int()); - } + { + History& h = Simulation::get_instance().get_history(); + History::LockNotify lock(h); + + h.edit_process(*selection, + name_entry->get_text(), + arrival_time_spin->get_value_as_int(), + base_priority_spin->get_value_as_int()); + } } add_process_dialog->hide(); @@ -467,13 +456,6 @@ SchedulablesTreeWidget::add_edit_thread(bool adding) arrival_time_spin->set_value(static_cast(t->get_arrival_time())); base_priority_spin->set_value(static_cast(t->get_base_priority())); } -// else -// { -// name_entry->set_text(""); -// cpu_time_spin->set_value(1.0); -// arrival_time_spin->set_value(0.0); -// base_priority_spin->set_value(0.0); -// } if(add_thread_dialog->run() == RESPONSE_OK)