- Now a thread is automatically added to a newly created process

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1320 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2007-01-18 12:27:38 +00:00
parent 9481d322c7
commit 3ec038e3d8
2 changed files with 205 additions and 280 deletions

View File

@ -1,237 +1,180 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!-- Generated with glade3
Version: 3.0.1
Date: Sat Dec 16 20:39:56 2006
User: matteo
Host: tulip
-->
<glade-interface>
<widget class="GtkDialog" id="AddProcessDialog">
<property name="title">Add Process</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="MainVBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="MainButtonBox">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="Cancel.Button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="OK.Button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<accelerator key="Return" modifiers="0" signal="clicked"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="MainTable">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">11</property>
<property name="column_spacing">9</property>
<child>
<widget class="GtkLabel" id="Name.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Name</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="BasePriority.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Base Priority</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="ArrivalTime.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Arrival Time</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="Name.Entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
<property name="width_chars">17</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="ArrivalTime.Spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 65536 1 0 0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="BasePriority.Spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 65536 1 0 0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="AddProcessDialog">
<property name="title">Add Process</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="MainVBox">
<property name="visible">True</property>
<child>
<widget class="GtkTable" id="MainTable">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">9</property>
<property name="row_spacing">11</property>
<child>
<widget class="GtkSpinButton" id="Duration.Spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">1 1 65536 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="Duration.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Duration</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="BasePriority.Spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">0 0 65536 1 0 0</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="ArrivalTime.Spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">0 0 65536 1 0 0</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="Name.Entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">17</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="ArrivalTime.Label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Arrival Time</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="BasePriority.Label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Base Priority</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="Name.Label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Name</property>
</widget>
<packing>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="MainButtonBox">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="Cancel.Button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="OK.Button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">-5</property>
<accelerator key="Return" modifiers="" signal="clicked"/>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -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<SubRequest*> subrequests = r.get_subrequests();
//
// for(Iseq<vector<SubRequest*>::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<double>(selection->get_arrival_time()));
duration_spin->set_value(static_cast<double>(selection->get_total_cpu_time()));
duration_spin->set_sensitive(false);
base_priority_spin->set_value(static_cast<double>(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<double>(t->get_arrival_time()));
base_priority_spin->set_value(static_cast<double>(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)