diff --git a/plugins/xmlsave/src/xml_serializer_factory.cc b/plugins/xmlsave/src/xml_serializer_factory.cc index a1c5cf1..70c1a34 100644 --- a/plugins/xmlsave/src/xml_serializer_factory.cc +++ b/plugins/xmlsave/src/xml_serializer_factory.cc @@ -281,8 +281,3 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters) } // add a sub request - Request, resource_key, duration } - - - - -/* comment */ diff --git a/src/add_request_dialog.cc b/src/add_request_dialog.cc index 761b330..5dad0ad 100644 --- a/src/add_request_dialog.cc +++ b/src/add_request_dialog.cc @@ -27,13 +27,12 @@ #include #include -#include -#include - #include "gettext.h" #include +#include +#include #include using namespace sgpem; @@ -109,9 +108,9 @@ AddRequestDialog::run_add(sgpem::Thread& owner) Request* r = NULL; // reset the dialog data -// _list_model->clear(); -// _instant_spin->set_value(0.0); -// _duration_spin->set_value(0.0); + // _list_model->clear(); + // _instant_spin->set_value(0.0); + // _duration_spin->set_value(0.0); if(run() == RESPONSE_OK) { @@ -249,7 +248,5 @@ AddRequestDialog::_on_row_removed(const Gtk::TreePath& path) void AddRequestDialog::_on_combo_selection_changed() { - _add_button->set_sensitive( - static_cast(_resource_combo->get_active())); + _add_button->set_sensitive(static_cast(_resource_combo->get_active())); } - diff --git a/src/backend/ready_queue.cc b/src/backend/ready_queue.cc index b318dac..6c21874 100644 --- a/src/backend/ready_queue.cc +++ b/src/backend/ready_queue.cc @@ -18,9 +18,6 @@ // along with SGPEMv2; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -#include "gettext.h" - #include using sgpem::ReadyQueue; diff --git a/src/backend/resource_policies_gatekeeper.cc b/src/backend/resource_policies_gatekeeper.cc index 1f35d8a..ee0e5e9 100644 --- a/src/backend/resource_policies_gatekeeper.cc +++ b/src/backend/resource_policies_gatekeeper.cc @@ -85,8 +85,8 @@ ResourcePoliciesGatekeeper::get_current_policy(History* history) throw(runtime_e PolicyIterator policy = _active_policies.find(history); if (policy == _active_policies.end()) - throw runtime_error("No active policy associated with this " - "history is available."); + throw runtime_error(_("No active policy associated with this ") + _("history is available.")); return *policy->second; } diff --git a/src/backend/resource_policy.cc b/src/backend/resource_policy.cc index 23dff89..63b4b10 100644 --- a/src/backend/resource_policy.cc +++ b/src/backend/resource_policy.cc @@ -19,7 +19,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include -using namespace std; + using namespace sgpem; ResourcePolicy::~ResourcePolicy() diff --git a/src/backend/resource_policy_priority_inheritance.cc b/src/backend/resource_policy_priority_inheritance.cc index 128e661..ae2f859 100644 --- a/src/backend/resource_policy_priority_inheritance.cc +++ b/src/backend/resource_policy_priority_inheritance.cc @@ -71,7 +71,7 @@ ResourcePolicyPriorityInheritance::enforce(Environment& environment, Environment { // non-allocated ones with lower priority go after the newly arrived int pthat = (**i).get_request().get_thread().get_current_priority(); - if(!inserted && pthis <= pthat) + if(!inserted && pthis <= pthat) { queue.push_back(&sr); inserted = true; @@ -84,7 +84,6 @@ ResourcePolicyPriorityInheritance::enforce(Environment& environment, Environment // increase the priority of a the thread to the maximum priority of any process waiting int push = pmax - (**i).get_request().get_thread().get_current_priority(); (**i).get_request().get_thread().set_priority_push(push); - } } } diff --git a/src/gui_builder.cc b/src/gui_builder.cc index a55ae7c..76e0509 100644 --- a/src/gui_builder.cc +++ b/src/gui_builder.cc @@ -127,14 +127,14 @@ GuiBuilder::on_view_show_holt_graph_activate() void GuiBuilder::on_view_show_statistics_activate() { - if(_statistics_container.get_main_window()->is_visible()) - { - _statistics_container.get_main_window()->hide(); - } - else - { - _statistics_container.get_main_window()->show(); - } + if(_statistics_container.get_main_window()->is_visible()) + { + _statistics_container.get_main_window()->hide(); + } + else + { + _statistics_container.get_main_window()->show(); + } } @@ -173,7 +173,7 @@ GuiBuilder::on_file_open_activate() Simulation& sim = Simulation::get_instance(); // open file dialog... - Gtk::FileChooserDialog dialog("Please choose a file", Gtk::FILE_CHOOSER_ACTION_OPEN); + Gtk::FileChooserDialog dialog(_("Please choose a file"), Gtk::FILE_CHOOSER_ACTION_OPEN); dialog.set_transient_for(get_initial_window()); if(!_filename.empty()) // Please test the following line extensively: dialog.set_current_folder(Glib::path_get_dirname(_filename)); @@ -193,7 +193,7 @@ GuiBuilder::on_file_open_activate() } Gtk::FileFilter filter_any; - filter_any.set_name("Any files"); + filter_any.set_name(_("Any files")); filter_any.add_pattern("*"); dialog.add_filter(filter_any); @@ -205,7 +205,7 @@ GuiBuilder::on_file_open_activate() sim.stop(); // It would work anyhow, but it'd look strange History& history = sim.get_history(); serializer.restore_snapshot(_filename, history); - msg = "File: " + _filename + " loaded."; + msg = _("File: ") + _filename + _(" loaded."); } // end - if(result==Gtk::RESPONSE_OK) } @@ -255,7 +255,7 @@ GuiBuilder::on_file_save_activate() History& history = Simulation::get_instance().get_history(); serializer.save_snapshot(_filename, history); - msg = "File: " + _filename + " saved."; + msg = _("File: ") + _filename + _(" saved."); } catch (std::out_of_range e) { @@ -296,7 +296,7 @@ GuiBuilder::on_file_saveas_activate() History& history = Simulation::get_instance().get_history(); // open file dialog... - Gtk::FileChooserDialog dialog("Please choose a file", Gtk::FILE_CHOOSER_ACTION_SAVE); + Gtk::FileChooserDialog dialog(_("Please choose a file"), Gtk::FILE_CHOOSER_ACTION_SAVE); dialog.set_transient_for(get_initial_window()); //Add response buttons the the dialog: @@ -310,7 +310,7 @@ GuiBuilder::on_file_saveas_activate() dialog.add_filter(filter_sgpem); Gtk::FileFilter filter_any; - filter_any.set_name("Any files"); + filter_any.set_name(_("Any files")); filter_any.add_pattern("*"); dialog.add_filter(filter_any); @@ -329,7 +329,7 @@ GuiBuilder::on_file_saveas_activate() serializer.save_snapshot(_filename, history); - msg = "File: " + _filename + " saved."; + msg = _("File: ") + _filename + _(" saved."); } // end - if(result==Gtk::RESPONSE_OK) } diff --git a/src/schedulables_statistics_widget.cc b/src/schedulables_statistics_widget.cc index 867bca2..420dd63 100644 --- a/src/schedulables_statistics_widget.cc +++ b/src/schedulables_statistics_widget.cc @@ -21,256 +21,252 @@ #include "gettext.h" - #include "schedulables_statistics_widget.hh" -#include + #include +#include +#include #include #include #include -#include - using namespace sgpem; using namespace std; - using namespace Gtk; using namespace Glib; TabularSchedulableStatisticsWidget::TabularSchedulableStatisticsWidget() { + _show_runs = _show_perc = _show_inactive = _show_turn = + _show_resp = _show_effic = + _show_ris_usage = _show_ris_block = true; - _show_runs = _show_perc = _show_inactive = _show_turn = - _show_resp = _show_effic = - _show_ris_usage = _show_ris_block = true; + //insert columns + _columns.add(_col_name); + _columns.add(_col_runs); + _columns.add(_col_perc); + _columns.add(_col_inactive); + _columns.add(_col_turn); + _columns.add(_col_resp); + _columns.add(_col_effic); + _columns.add(_col_ris_usage); + _columns.add(_col_ris_block); - //insert columns - _columns.add(_col_name); - _columns.add(_col_runs); - _columns.add(_col_perc); - _columns.add(_col_inactive); - _columns.add(_col_turn); - _columns.add(_col_resp); - _columns.add(_col_effic); - _columns.add(_col_ris_usage); - _columns.add(_col_ris_block); + _model = TreeStore::create(_columns); + set_model(_model); - _model = TreeStore::create(_columns); - set_model(_model); + //show only columns chosen by the user + update_columns(); - //show only columns chosen by the user - update_columns(); + set_headers_visible(true); - set_headers_visible(true); - - // Register this HistoryObserver: - Simulation::get_instance().get_history().attach(*this); + // Register this HistoryObserver: + Simulation::get_instance().get_history().attach(*this); } TabularSchedulableStatisticsWidget::~TabularSchedulableStatisticsWidget() { - Simulation::get_instance().get_history().detach(*this); + Simulation::get_instance().get_history().detach(*this); } void TabularSchedulableStatisticsWidget::update(const History& changed_history) { - _model->clear(); + _model->clear(); - Statistics::get_instance().calculateStatisticsAt(changed_history.get_front()); - vector p_stats = Statistics::get_instance().get_process_statistics(); + Statistics::get_instance().calculateStatisticsAt(changed_history.get_front()); + vector p_stats = Statistics::get_instance().get_process_statistics(); - for(unsigned int i_p = 0; i_p < p_stats.size(); i_p++) - { - TreeModel::Row riga_P = *(_model->append()); - - riga_P[_col_name] = p_stats[i_p]->get_core()->get_name(); - riga_P[_col_runs] = p_stats[i_p]->get_execution_time(); - stringstream s1; s1 << p_stats[i_p]->get_execution_progress() << "%"; - riga_P[_col_perc] = Glib::ustring(s1.str()); - riga_P[_col_inactive]= p_stats[i_p]->get_total_inactivity(); - stringstream s2; - if (p_stats[i_p]->get_response_time() != -1) - s2 << p_stats[i_p]->get_response_time() << " (avg:" << p_stats[i_p]->get_average_response_time() << ")"; - else - s2 << "---"; - riga_P[_col_resp] = Glib::ustring(s2.str()); - riga_P[_col_turn] = p_stats[i_p]->get_turn_around(); - stringstream s3; - if (p_stats[i_p]->get_efficiency() != -1) - s3 << p_stats[i_p]->get_efficiency() << "%"; - else - s3 << "---"; - riga_P[_col_effic] = Glib::ustring(s3.str()); - riga_P[_col_ris_usage] = p_stats[i_p]->get_resource_usage_time(); - riga_P[_col_ris_block] = p_stats[i_p]->get_resource_waitings_time(); + for(unsigned int i_p = 0; i_p < p_stats.size(); i_p++) + { + TreeModel::Row riga_P = *(_model->append()); + riga_P[_col_name] = p_stats[i_p]->get_core()->get_name(); + riga_P[_col_runs] = p_stats[i_p]->get_execution_time(); + stringstream s1; + s1 << p_stats[i_p]->get_execution_progress() << "%"; + riga_P[_col_perc] = Glib::ustring(s1.str()); + riga_P[_col_inactive] = p_stats[i_p]->get_total_inactivity(); + stringstream s2; + if (p_stats[i_p]->get_response_time() != -1) + s2 << p_stats[i_p]->get_response_time() << " (avg:" << p_stats[i_p]->get_average_response_time() << ")"; + else + s2 << "---"; + riga_P[_col_resp] = Glib::ustring(s2.str()); + riga_P[_col_turn] = p_stats[i_p]->get_turn_around(); + stringstream s3; + if (p_stats[i_p]->get_efficiency() != -1) + s3 << p_stats[i_p]->get_efficiency() << "%"; + else + s3 << "---"; + riga_P[_col_effic] = Glib::ustring(s3.str()); + riga_P[_col_ris_usage] = p_stats[i_p]->get_resource_usage_time(); + riga_P[_col_ris_block] = p_stats[i_p]->get_resource_waitings_time(); - vector t_stats = p_stats[i_p]->get_threads_statistics(); - - for(unsigned int i_t = 0; i_t < t_stats.size(); i_t++) - { - TreeModel::Row riga_T = *(_model->append(riga_P.children())); - riga_T[_col_name] = t_stats[i_t]->get_core()->get_name(); - riga_T[_col_runs] = t_stats[i_t]->get_execution_time(); - stringstream s1; s1 << t_stats[i_t]->get_execution_progress() << "%"; - riga_T[_col_perc] = Glib::ustring(s1.str()); - riga_T[_col_inactive]= t_stats[i_t]->get_total_inactivity(); - stringstream s2; - if (t_stats[i_t]->get_response_time() != -1) - s2 << t_stats[i_t]->get_response_time(); - else - s2 << "---"; - riga_T[_col_resp] = Glib::ustring(s2.str()); - riga_T[_col_turn] = t_stats[i_t]->get_turn_around(); - stringstream s3; - if (t_stats[i_t]->get_efficiency() != -1) - s3 <get_efficiency() << "%"; - else - s3 << "---"; - riga_T[_col_effic] = Glib::ustring(s3.str()); - riga_T[_col_ris_usage] = t_stats[i_t]->get_resource_usage_time(); - riga_T[_col_ris_block] = t_stats[i_t]->get_resource_waitings_time(); - } - } - expand_all(); + vector t_stats = p_stats[i_p]->get_threads_statistics(); + + for(unsigned int i_t = 0; i_t < t_stats.size(); i_t++) + { + TreeModel::Row riga_T = *(_model->append(riga_P.children())); + riga_T[_col_name] = t_stats[i_t]->get_core()->get_name(); + riga_T[_col_runs] = t_stats[i_t]->get_execution_time(); + stringstream s1; + s1 << t_stats[i_t]->get_execution_progress() << "%"; + riga_T[_col_perc] = Glib::ustring(s1.str()); + riga_T[_col_inactive] = t_stats[i_t]->get_total_inactivity(); + stringstream s2; + if (t_stats[i_t]->get_response_time() != -1) + s2 << t_stats[i_t]->get_response_time(); + else + s2 << "---"; + riga_T[_col_resp] = Glib::ustring(s2.str()); + riga_T[_col_turn] = t_stats[i_t]->get_turn_around(); + stringstream s3; + if (t_stats[i_t]->get_efficiency() != -1) + s3 <get_efficiency() << "%"; + else + s3 << "---"; + riga_T[_col_effic] = Glib::ustring(s3.str()); + riga_T[_col_ris_usage] = t_stats[i_t]->get_resource_usage_time(); + riga_T[_col_ris_block] = t_stats[i_t]->get_resource_waitings_time(); + } + } + expand_all(); } void TabularSchedulableStatisticsWidget::update_columns() { - remove_all_columns(); + remove_all_columns(); - append_column(_("Schedulable"), _col_name); + append_column(_("Schedulable"), _col_name); - if (_show_runs) - append_column(_("Running"), _col_runs); + if (_show_runs) + append_column(_("Running"), _col_runs); - if (_show_perc ) - append_column(_("Completed"), _col_perc); + if (_show_perc ) + append_column(_("Completed"), _col_perc); - if (_show_inactive) - append_column(_("Inactivity"), _col_inactive); + if (_show_inactive) + append_column(_("Inactivity"), _col_inactive); - if (_show_turn) - append_column(_("Turn Around"), _col_turn); + if (_show_turn) + append_column(_("Turn Around"), _col_turn); - if (_show_resp) - append_column(_("Response"), _col_resp); + if (_show_resp) + append_column(_("Response"), _col_resp); - //if (_show_turn) -// append_column(_("Turn Around"), _col_inactive); + // if (_show_turn) + // append_column(_("Turn Around"), _col_inactive); - if (_show_effic) - append_column(_("Efficiency"), _col_effic); - - if (_show_ris_usage) - append_column(_("Res. usage"), _col_ris_usage); - - if (_show_ris_block) - append_column(_("Res. block"), _col_ris_block); + if (_show_effic) + append_column(_("Efficiency"), _col_effic); + if (_show_ris_usage) + append_column(_("Res. usage"), _col_ris_usage); + if (_show_ris_block) + append_column(_("Res. block"), _col_ris_block); } void TabularSchedulableStatisticsWidget::set_show_runs(bool b) { - _show_runs = b; + _show_runs = b; } bool TabularSchedulableStatisticsWidget::get_show_runs() const { - return _show_runs; + return _show_runs; } void TabularSchedulableStatisticsWidget::set_show_perc(bool b) { - _show_perc = b; + _show_perc = b; } bool TabularSchedulableStatisticsWidget::get_show_perc() const { - return _show_perc; + return _show_perc; } void TabularSchedulableStatisticsWidget::set_show_inactive(bool b) { - _show_inactive = b; + _show_inactive = b; } bool TabularSchedulableStatisticsWidget::get_show_inactive() const { - return _show_inactive; + return _show_inactive; } void TabularSchedulableStatisticsWidget::set_show_turn_around(bool b) { - _show_turn = b; + _show_turn = b; } bool TabularSchedulableStatisticsWidget::get_show_turn_around() const { - return _show_turn; + return _show_turn; } void TabularSchedulableStatisticsWidget::set_show_response(bool b) { - _show_resp = b; + _show_resp = b; } bool TabularSchedulableStatisticsWidget::get_show_response() const { - return _show_resp; + return _show_resp; } void TabularSchedulableStatisticsWidget::set_show_efficiency(bool b) { - _show_effic = b; + _show_effic = b; } bool TabularSchedulableStatisticsWidget::get_show_efficiency() const { - return _show_effic; + return _show_effic; } void TabularSchedulableStatisticsWidget::set_show_resource_usage(bool b) { - _show_ris_usage= b; + _show_ris_usage= b; } bool TabularSchedulableStatisticsWidget::get_show_resource_usage() const { - return _show_ris_usage; + return _show_ris_usage; } void TabularSchedulableStatisticsWidget::set_show_resource_block(bool b) { - _show_ris_block= b; + _show_ris_block= b; } bool TabularSchedulableStatisticsWidget::get_show_resource_block() const { - return _show_ris_block; + return _show_ris_block; } /*