Minor fixes and small, negligible, boring code cleanups.
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1348 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
89bc9866c7
commit
1220e1be16
|
@ -347,6 +347,7 @@ bin_PROGRAMS += sgpemv2
|
||||||
sgpemv2_CPPFLAGS = \
|
sgpemv2_CPPFLAGS = \
|
||||||
-I@top_srcdir@ \
|
-I@top_srcdir@ \
|
||||||
-I@top_srcdir@/src/backend \
|
-I@top_srcdir@/src/backend \
|
||||||
|
-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED \
|
||||||
-DEXAMPLESDIR="\"$(examplesdir)\"" \
|
-DEXAMPLESDIR="\"$(examplesdir)\"" \
|
||||||
-DLOCALEDIR="\"$(localedir)\"" \
|
-DLOCALEDIR="\"$(localedir)\"" \
|
||||||
-DSHAREDIR="\"$(sharedir)\"" \
|
-DSHAREDIR="\"$(sharedir)\"" \
|
||||||
|
|
|
@ -44,6 +44,7 @@ AC_CANONICAL_TARGET
|
||||||
|
|
||||||
dnl starting automake
|
dnl starting automake
|
||||||
AM_INIT_AUTOMAKE([dejagnu dist-bzip2 subdir-objects])
|
AM_INIT_AUTOMAKE([dejagnu dist-bzip2 subdir-objects])
|
||||||
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
dnl HACK to avoid multiple definition of macros when
|
dnl HACK to avoid multiple definition of macros when
|
||||||
dnl including spgemv2-config.h (autoheader generated)
|
dnl including spgemv2-config.h (autoheader generated)
|
||||||
|
@ -66,7 +67,8 @@ AC_CHECK_CXXFLAG([CXXFLAGS], [Wall])
|
||||||
AC_CHECK_CXXFLAG([CXXFLAGS], [pedantic])
|
AC_CHECK_CXXFLAG([CXXFLAGS], [pedantic])
|
||||||
AC_CHECK_CXXFLAG([CXXFLAGS], [Wextra])
|
AC_CHECK_CXXFLAG([CXXFLAGS], [Wextra])
|
||||||
AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-long-long])
|
AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-long-long])
|
||||||
AC_CHECK_LDFLAG([LDFLAGS],[--as-needed])
|
AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-strict-aliasing])
|
||||||
|
AC_CHECK_LDFLAG([LDFLAGS], [--as-needed])
|
||||||
|
|
||||||
dnl see if we've to enable debug flags
|
dnl see if we've to enable debug flags
|
||||||
AC_ARG_ENABLE([debug],
|
AC_ARG_ENABLE([debug],
|
||||||
|
@ -86,7 +88,7 @@ AC_ARG_ENABLE([visibility-support],
|
||||||
AS_HELP_STRING([--enable-visibility-support],
|
AS_HELP_STRING([--enable-visibility-support],
|
||||||
[enable the new GCC visibility support; requires GCC >= 4.0 to work.]),
|
[enable the new GCC visibility support; requires GCC >= 4.0 to work.]),
|
||||||
[enable_gcc_visibility="$enableval"],
|
[enable_gcc_visibility="$enableval"],
|
||||||
[enable_gcc_visibility="no"])
|
[enable_gcc_visibility="yes"])
|
||||||
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
|
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
|
||||||
AC_MSG_RESULT([$enable_gcc_visibility])
|
AC_MSG_RESULT([$enable_gcc_visibility])
|
||||||
if test "x$enable_gcc_visibility" = "xno"; then
|
if test "x$enable_gcc_visibility" = "xno"; then
|
||||||
|
|
|
@ -44,6 +44,7 @@ AC_CANONICAL_TARGET
|
||||||
|
|
||||||
dnl starting automake
|
dnl starting automake
|
||||||
AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
|
AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
|
||||||
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
dnl gettext & libtool
|
dnl gettext & libtool
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
@ -86,7 +87,7 @@ AC_ARG_ENABLE([visibility-support],
|
||||||
AS_HELP_STRING([--enable-visibility-support],
|
AS_HELP_STRING([--enable-visibility-support],
|
||||||
[enable the new GCC visibility support; requires GCC >= 4.0 to work.]),
|
[enable the new GCC visibility support; requires GCC >= 4.0 to work.]),
|
||||||
[enable_gcc_visibility="$enableval"],
|
[enable_gcc_visibility="$enableval"],
|
||||||
[enable_gcc_visibility="no"])
|
[enable_gcc_visibility="yes"])
|
||||||
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
|
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
|
||||||
AC_MSG_RESULT([$enable_gcc_visibility])
|
AC_MSG_RESULT([$enable_gcc_visibility])
|
||||||
if test "x$enable_gcc_visibility" = "xno"; then
|
if test "x$enable_gcc_visibility" = "xno"; then
|
||||||
|
|
|
@ -88,8 +88,9 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio
|
||||||
// Now takes the user-defined policy class from pUserCPUPolicyDict
|
// Now takes the user-defined policy class from pUserCPUPolicyDict
|
||||||
PyObject* pCPUPolicyClass = PyDict_GetItemString(_upolicy_dict, name);
|
PyObject* pCPUPolicyClass = PyDict_GetItemString(_upolicy_dict, name);
|
||||||
if (pCPUPolicyClass == NULL)
|
if (pCPUPolicyClass == NULL)
|
||||||
throw MalformedPolicyException(Glib::ustring(_("Cannot find a class named ")) +
|
throw new MalformedPolicyException (Glib::ustring::compose (
|
||||||
name + _(" into the corresponding .py file."));
|
_("Cannot find a class named %1 into the corresponding .py file."),
|
||||||
|
name));
|
||||||
|
|
||||||
// Retrieve a description for the policy using the __doc__ attribute
|
// Retrieve a description for the policy using the __doc__ attribute
|
||||||
PyObject* pDescriptionString = PyObject_GetAttrString(pCPUPolicyClass, "__doc__");
|
PyObject* pDescriptionString = PyObject_GetAttrString(pCPUPolicyClass, "__doc__");
|
||||||
|
|
|
@ -44,6 +44,7 @@ AC_CANONICAL_TARGET
|
||||||
|
|
||||||
dnl starting automake
|
dnl starting automake
|
||||||
AM_INIT_AUTOMAKE([dejagnu dist-bzip2 subdir-objects])
|
AM_INIT_AUTOMAKE([dejagnu dist-bzip2 subdir-objects])
|
||||||
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
dnl gettext & libtool
|
dnl gettext & libtool
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
|
@ -83,7 +84,7 @@ AC_ARG_ENABLE([visibility-support],
|
||||||
AS_HELP_STRING([--enable-visibility-support],
|
AS_HELP_STRING([--enable-visibility-support],
|
||||||
[enable the new GCC visibility support; requires GCC >= 4.0 to work.]),
|
[enable the new GCC visibility support; requires GCC >= 4.0 to work.]),
|
||||||
[enable_gcc_visibility="$enableval"],
|
[enable_gcc_visibility="$enableval"],
|
||||||
[enable_gcc_visibility="no"])
|
[enable_gcc_visibility="yes"])
|
||||||
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
|
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
|
||||||
AC_MSG_RESULT([$enable_gcc_visibility])
|
AC_MSG_RESULT([$enable_gcc_visibility])
|
||||||
if test "x$enable_gcc_visibility" = "xno"; then
|
if test "x$enable_gcc_visibility" = "xno"; then
|
||||||
|
|
|
@ -137,7 +137,7 @@ void XMLSerializer::fill_doc(xmlDocPtr doc, const History& hist)
|
||||||
/*
|
/*
|
||||||
* Creates a DTD declaration. Isn't mandatory.
|
* Creates a DTD declaration. Isn't mandatory.
|
||||||
*/
|
*/
|
||||||
xmlDtdPtr dtd = xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd");
|
/* xmlDtdPtr dtd = */ xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd");
|
||||||
|
|
||||||
//TODO: check for DTD compliance??
|
//TODO: check for DTD compliance??
|
||||||
|
|
||||||
|
|
|
@ -233,13 +233,13 @@ AddRequestDialog::_on_list_selection_changed()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AddRequestDialog::_on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it)
|
AddRequestDialog::_on_row_added(const Gtk::TreePath&, const Gtk::TreeIter&)
|
||||||
{
|
{
|
||||||
_ok_button->set_sensitive(true);
|
_ok_button->set_sensitive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AddRequestDialog::_on_row_removed(const Gtk::TreePath& path)
|
AddRequestDialog::_on_row_removed(const Gtk::TreePath&)
|
||||||
{
|
{
|
||||||
_ok_button->set_sensitive(static_cast<bool>(_list_model->children()));
|
_ok_button->set_sensitive(static_cast<bool>(_list_model->children()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with SGPEMv2. If not, see http://www.gnu.org/licenses/.
|
// along with SGPEMv2. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <sgpemv2/module.hh>
|
#include <sgpemv2/module.hh>
|
||||||
|
|
||||||
using namespace sgpem;
|
using namespace sgpem;
|
||||||
|
@ -39,12 +36,12 @@ Module::Module(const Glib::ustring& identifier) throw(InvalidPluginException) :
|
||||||
|
|
||||||
// Type-safeness here is an optional, as always. :-)
|
// Type-safeness here is an optional, as always. :-)
|
||||||
std::string prefix = "sgpem__Plugin__";
|
std::string prefix = "sgpem__Plugin__";
|
||||||
if (!(get_symbol(prefix + "on_init", (void*&) on_init_ptr) &&
|
if (!(get_symbol(prefix + "on_init", reinterpret_cast<void*&>(on_init_ptr)) &&
|
||||||
get_symbol(prefix + "on_exit", (void*&) on_exit_ptr) &&
|
get_symbol(prefix + "on_exit", reinterpret_cast<void*&>(on_exit_ptr)) &&
|
||||||
get_symbol(prefix + "describe", (void*&) describe_ptr) &&
|
get_symbol(prefix + "describe", reinterpret_cast<void*&>(describe_ptr)) &&
|
||||||
get_symbol(prefix + "get_name", (void*&) get_name_ptr) &&
|
get_symbol(prefix + "get_name", reinterpret_cast<void*&>(get_name_ptr)) &&
|
||||||
get_symbol(prefix + "get_author", (void*&) get_author_ptr) &&
|
get_symbol(prefix + "get_author", reinterpret_cast<void*&>(get_author_ptr)) &&
|
||||||
get_symbol(prefix + "get_version", (void*&) get_version_ptr)))
|
get_symbol(prefix + "get_version", reinterpret_cast<void*&>(get_version_ptr))))
|
||||||
throw InvalidPluginException("incomplete/wrong exported interface");
|
throw InvalidPluginException("incomplete/wrong exported interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ using std::runtime_error;
|
||||||
using namespace sgpem;
|
using namespace sgpem;
|
||||||
|
|
||||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||||
template class SG_DLLEXPORT Singleton<SerializersGatekeeper>;
|
template class Singleton<SerializersGatekeeper>;
|
||||||
|
|
||||||
typedef vector<Serializer*>::iterator SerializerIterator;
|
typedef vector<Serializer*>::iterator SerializerIterator;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace sgpem
|
||||||
* thread-safeness.
|
* thread-safeness.
|
||||||
*/
|
*/
|
||||||
template<typename Instantiated_class>
|
template<typename Instantiated_class>
|
||||||
class SG_DLLEXPORT Singleton
|
class Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -217,14 +217,15 @@ GuiBuilder::open_file(const std::string& basedir)
|
||||||
sim.stop(); // It would work anyhow, but it'd look strange
|
sim.stop(); // It would work anyhow, but it'd look strange
|
||||||
History& history = sim.get_history();
|
History& history = sim.get_history();
|
||||||
serializer.restore_snapshot(_filename, history);
|
serializer.restore_snapshot(_filename, history);
|
||||||
msg = _("File: ") + _filename + _(" loaded.");
|
msg = Glib::ustring::compose (_("File: %1 loaded."), _filename);
|
||||||
} // end - if(result==Gtk::RESPONSE_OK)
|
} // end - if(result==Gtk::RESPONSE_OK)
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::out_of_range e)
|
catch (std::out_of_range e)
|
||||||
{
|
{
|
||||||
Gtk::MessageDialog error(get_initial_window(),
|
Gtk::MessageDialog error(get_initial_window(),
|
||||||
_("<b>No serializer available.</b>\nThere's no registered serializer. Please check the loaded plugins."),
|
_("<b>No serializer available.</b>\nThere's no "
|
||||||
|
"registered serializer. Please check the loaded plugins."),
|
||||||
true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||||
error.run();
|
error.run();
|
||||||
msg = _("ERROR: No registered serializer available");
|
msg = _("ERROR: No registered serializer available");
|
||||||
|
|
|
@ -165,8 +165,9 @@ parse_options(int argc, char** argv)
|
||||||
} // ~ try
|
} // ~ try
|
||||||
catch (Glib::OptionError e)
|
catch (Glib::OptionError e)
|
||||||
{
|
{
|
||||||
std::cout << _("Bad invocation: ") << e.what() << std::endl;
|
std::cout << Glib::ustring::compose (_("Bad invocation: %1\nUse the `-?' "
|
||||||
std::cout << _("Use the `-?' or `--help' option to see the help") << std::endl;
|
"or `--help' option to see the help."),
|
||||||
|
e.what()) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ ResourcesWidget::CellRendererTextMarkup::_property_renderable()
|
||||||
return Glib::PropertyProxy_Base(this, "markup");
|
return Glib::PropertyProxy_Base(this, "markup");
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr<Builder>& ui) :
|
ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr<Builder>&) :
|
||||||
TreeView(cobject),
|
TreeView(cobject),
|
||||||
_add_resource_dialog_ui(Builder::create_from_file(UIDIR "/add-resource-dialog.ui"))
|
_add_resource_dialog_ui(Builder::create_from_file(UIDIR "/add-resource-dialog.ui"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -269,7 +269,7 @@ SchedulablesTreeWidget::_update_expanded_vector(Gtk::TreeView*, const Gtk::TreeM
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SchedulablesTreeWidget::update(const History& history)
|
SchedulablesTreeWidget::update(const History&)
|
||||||
{
|
{
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
@ -642,9 +642,8 @@ SchedulablesTreeWidget::markup_schedulable(const Schedulable& s)
|
||||||
oss << "<span size=\"8500\"><span foreground=\""
|
oss << "<span size=\"8500\"><span foreground=\""
|
||||||
<< GlobalPreferences::get_instance().get_schedulable_color(s.get_state())
|
<< GlobalPreferences::get_instance().get_schedulable_color(s.get_state())
|
||||||
<< "\"><b>" << Markup::escape_text(s.get_name()) << "</b></span>"
|
<< "\"><b>" << Markup::escape_text(s.get_name()) << "</b></span>"
|
||||||
<< _(" (") << s.get_elapsed_time()
|
<< Glib::ustring::compose(_(" (%1/%2), current_priority: %3"),
|
||||||
<< _("/") << s.get_total_cpu_time() << ")"
|
s.get_elapsed_time(), s.get_total_cpu_time(), s.get_current_priority())
|
||||||
<< _(", current priority: ") << s.get_current_priority()
|
|
||||||
<< "</span>";
|
<< "</span>";
|
||||||
|
|
||||||
return oss.str();
|
return oss.str();
|
||||||
|
|
|
@ -195,14 +195,14 @@ SimulationController::run_simulation_adaptor()
|
||||||
catch(const UserInterruptException& uie)
|
catch(const UserInterruptException& uie)
|
||||||
{
|
{
|
||||||
// Show the user a dialog
|
// Show the user a dialog
|
||||||
MessageDialog diag(_("<b>The selected user CPU policy stopped before returning:</b>\n") + Markup::escape_text(uie.what()),
|
MessageDialog diag (_("<b>The selected user CPU policy stopped before returning:</b>\n") + Markup::escape_text(uie.what()),
|
||||||
true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||||
diag.run();
|
diag.run();
|
||||||
}
|
}
|
||||||
catch(const MalformedPolicyException& mpe)
|
catch(const MalformedPolicyException& mpe)
|
||||||
{
|
{
|
||||||
// Show user a dialog
|
// Show user a dialog
|
||||||
MessageDialog diag(_("<b>The selected user CPU policy was malformed and failed to sort the queue:</b>\n") +
|
MessageDialog diag (_("<b>The selected user CPU policy was malformed and failed to sort the queue:</b>\n") +
|
||||||
Markup::escape_text(mpe.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
Markup::escape_text(mpe.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||||
diag.run();
|
diag.run();
|
||||||
|
|
||||||
|
@ -214,8 +214,9 @@ SimulationController::run_simulation_adaptor()
|
||||||
catch(const CPUPolicyException& cpe)
|
catch(const CPUPolicyException& cpe)
|
||||||
{
|
{
|
||||||
// Fatal error. We should never get here.
|
// Fatal error. We should never get here.
|
||||||
std::cerr << _(" [EE] Fatal error. Impossible to deactivate the policy in ") << __FILE__ << ":" << __LINE__
|
std::cerr << Glib::ustring::compose(
|
||||||
<< std::endl << _(" [EE] ") << cpe.what() << std::endl;
|
_(" [EE] Fatal error. Impossible to deactivate the policy in file %1:%2"), __FILE__, __LINE__)
|
||||||
|
<< std::endl << _(" [EE] ") << cpe.what() << std::endl;
|
||||||
;
|
;
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ TestWidget::~TestWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TestWidget::on_button_press_event(GdkEventButton* event)
|
TestWidget::on_button_press_event(GdkEventButton*)
|
||||||
{
|
{
|
||||||
std::cout << " on_button_press_event " << std::endl;
|
std::cout << " on_button_press_event " << std::endl;
|
||||||
change_scaling_mode();
|
change_scaling_mode();
|
||||||
|
@ -151,7 +151,7 @@ TestWidget::draw_widget(cairo_t* ctx)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TestWidget::calc_drawing_size(cairo_t* ctx, size_t& width, size_t& height)
|
TestWidget::calc_drawing_size(cairo_t*, size_t& width, size_t& height)
|
||||||
{
|
{
|
||||||
width = _desired_w;
|
width = _desired_w;
|
||||||
height = _desired_h;
|
height = _desired_h;
|
||||||
|
|
|
@ -44,7 +44,7 @@ class DummyObserver : public HistoryObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DummyObserver() : _i(0) {}
|
DummyObserver() : _i(0) {}
|
||||||
void update(const History& history)
|
void update(const History&)
|
||||||
{
|
{
|
||||||
cout << "Observer.update() : " << ++_i << endl;
|
cout << "Observer.update() : " << ++_i << endl;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ find_thread(const ConcreteEnvironment& env, const Thread& _thread)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int, char**)
|
||||||
{
|
{
|
||||||
ostream& info = cout;
|
ostream& info = cout;
|
||||||
ostream& test = cerr;
|
ostream& test = cerr;
|
||||||
|
@ -217,7 +217,7 @@ main(int argc, char** argv)
|
||||||
threads[2].arrival_time,
|
threads[2].arrival_time,
|
||||||
threads[2].base_priority);
|
threads[2].base_priority);
|
||||||
|
|
||||||
DynamicThread& p2_2 = h.add_thread(threads[3].name,
|
/*DynamicThread& p2_2 = */ h.add_thread(threads[3].name,
|
||||||
*threads[3].parent,
|
*threads[3].parent,
|
||||||
threads[3].cpu_time,
|
threads[3].cpu_time,
|
||||||
threads[3].arrival_time,
|
threads[3].arrival_time,
|
||||||
|
@ -256,7 +256,7 @@ main(int argc, char** argv)
|
||||||
{ &req2, res1.first, 1 }
|
{ &req2, res1.first, 1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const DynamicSubRequest& sreq1 = h.add_subrequest(*subrequests[0].request,
|
/*const DynamicSubRequest& sreq1 = */ h.add_subrequest(*subrequests[0].request,
|
||||||
subrequests[0].resource_key,
|
subrequests[0].resource_key,
|
||||||
subrequests[0].duration);
|
subrequests[0].duration);
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ main(int argc, char** argv)
|
||||||
subrequests[1].resource_key,
|
subrequests[1].resource_key,
|
||||||
subrequests[1].duration);
|
subrequests[1].duration);
|
||||||
|
|
||||||
const DynamicSubRequest& sreq3 = h.add_subrequest(*subrequests[2].request,
|
/* const DynamicSubRequest& sreq3 = */ h.add_subrequest(*subrequests[2].request,
|
||||||
subrequests[2].resource_key,
|
subrequests[2].resource_key,
|
||||||
subrequests[2].duration);
|
subrequests[2].duration);
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
ThreadCreationData p1_3_d = { "p1_3", &p1, 3, 4, 0 };
|
ThreadCreationData p1_3_d = { "p1_3", &p1, 3, 4, 0 };
|
||||||
|
|
||||||
Thread& p1_3 = h.add_thread(p1_3_d.name,
|
/* Thread& p1_3 = */ h.add_thread(p1_3_d.name,
|
||||||
*p1_3_d.parent,
|
*p1_3_d.parent,
|
||||||
p1_3_d.cpu_time,
|
p1_3_d.cpu_time,
|
||||||
p1_3_d.arrival_time,
|
p1_3_d.arrival_time,
|
||||||
|
|
|
@ -102,9 +102,9 @@ public:
|
||||||
ReadyQueue* sl = Scheduler::get_instance().get_ready_queue();
|
ReadyQueue* sl = Scheduler::get_instance().get_ready_queue();
|
||||||
if(sl && sl->size()>=2)
|
if(sl && sl->size()>=2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sl->size(); i++)
|
for (guint i = 0; i < sl->size(); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < sl->size() - 1; j++)
|
for (guint j = 0; j < sl->size() - 1; j++)
|
||||||
{
|
{
|
||||||
if ( (sl->get_item_at(j).get_current_priority() < sl->get_item_at(j + 1).get_current_priority())
|
if ( (sl->get_item_at(j).get_current_priority() < sl->get_item_at(j + 1).get_current_priority())
|
||||||
|| ((sl->get_item_at(j).get_current_priority() == sl->get_item_at(j + 1).get_current_priority())
|
|| ((sl->get_item_at(j).get_current_priority() == sl->get_item_at(j + 1).get_current_priority())
|
||||||
|
@ -247,7 +247,6 @@ protected:
|
||||||
virtual bool on_timer_timeout();
|
virtual bool on_timer_timeout();
|
||||||
|
|
||||||
// TestWidget _test_widget;
|
// TestWidget _test_widget;
|
||||||
SimulationWidget _simulation_widget;
|
|
||||||
Gtk::Button _start_button;
|
Gtk::Button _start_button;
|
||||||
Gtk::Button _stop_button;
|
Gtk::Button _stop_button;
|
||||||
Gtk::Button _pause_button;
|
Gtk::Button _pause_button;
|
||||||
|
@ -255,6 +254,7 @@ protected:
|
||||||
Gtk::HBox _buttons_box;
|
Gtk::HBox _buttons_box;
|
||||||
Gtk::VBox _main_box;
|
Gtk::VBox _main_box;
|
||||||
Gtk::ScrolledWindow _scroller;
|
Gtk::ScrolledWindow _scroller;
|
||||||
|
SimulationWidget _simulation_widget;
|
||||||
Simulation::state _sim_state;
|
Simulation::state _sim_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
ostream& info = cout;
|
ostream& info = cout;
|
||||||
ostream& test = cerr;
|
/*ostream& test = cerr;*/
|
||||||
|
|
||||||
Gtk::Main kit(argc, argv);
|
Gtk::Main kit(argc, argv);
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ void fillHistory(History &hist)
|
||||||
Thread& p1_t1 = hist.add_thread(Glib::ustring("P1 - Thread 1"), p1, 14, 0, 2);
|
Thread& p1_t1 = hist.add_thread(Glib::ustring("P1 - Thread 1"), p1, 14, 0, 2);
|
||||||
|
|
||||||
// add a thread - name, parent, cpu time, arrival time, priority
|
// add a thread - name, parent, cpu time, arrival time, priority
|
||||||
Thread& p1_t2 = hist.add_thread(Glib::ustring("P1 - Thread 2"), p1, 8, 0, 5);
|
/* Thread& p1_t2 = */ hist.add_thread(Glib::ustring("P1 - Thread 2"), p1, 8, 0, 5);
|
||||||
|
|
||||||
// add a thread - name, parent, cpu time, arrival time, priority
|
// add a thread - name, parent, cpu time, arrival time, priority
|
||||||
Thread& p2_t1 = hist.add_thread(Glib::ustring("P2 - Thread 1"), p2, 20, 0, 2);
|
Thread& p2_t1 = hist.add_thread(Glib::ustring("P2 - Thread 1"), p2, 20, 0, 2);
|
||||||
|
@ -502,31 +502,31 @@ void fillHistory(History &hist)
|
||||||
Thread& p3_t1 = hist.add_thread(Glib::ustring("P3 - Thread 2"), p3, 12, 0, 2);
|
Thread& p3_t1 = hist.add_thread(Glib::ustring("P3 - Thread 2"), p3, 12, 0, 2);
|
||||||
|
|
||||||
// add a thread - name, parent, cpu time, arrival time, priority
|
// add a thread - name, parent, cpu time, arrival time, priority
|
||||||
Thread& p4_t1 = hist.add_thread(Glib::ustring("P4 - Thread 1"), p4, 3, 0, 2);
|
/* Thread& p4_t1 = */ hist.add_thread(Glib::ustring("P4 - Thread 1"), p4, 3, 0, 2);
|
||||||
|
|
||||||
// add a request - Thread, time
|
// add a request - Thread, time
|
||||||
Request& req1 = hist.add_request(p1_t1, 3);
|
Request& req1 = hist.add_request(p1_t1, 3);
|
||||||
|
|
||||||
// add a sub request - Request, resource_key, duration, places
|
// add a sub request - Request, resource_key, duration, places
|
||||||
SubRequest& req1_sub1 = hist.add_subrequest(req1, respair.first, 6);
|
/* SubRequest& req1_sub1 = */ hist.add_subrequest(req1, respair.first, 6);
|
||||||
|
|
||||||
// add a request - Thread, time
|
// add a request - Thread, time
|
||||||
Request& req2 = hist.add_request(p2_t1, 1);
|
Request& req2 = hist.add_request(p2_t1, 1);
|
||||||
|
|
||||||
// add a sub request - Request, resource_key, duration, places
|
// add a sub request - Request, resource_key, duration, places
|
||||||
SubRequest& req2_sub1 = hist.add_subrequest(req2, respair.first, 4);
|
/* SubRequest& req2_sub1 = */ hist.add_subrequest(req2, respair.first, 4);
|
||||||
|
|
||||||
// add a request - Thread, time
|
// add a request - Thread, time
|
||||||
Request& req3 = hist.add_request(p3_t1, 0);
|
Request& req3 = hist.add_request(p3_t1, 0);
|
||||||
|
|
||||||
// add a sub request - Request, resource_key, duration, places
|
// add a sub request - Request, resource_key, duration, places
|
||||||
SubRequest& req3_sub1 = hist.add_subrequest(req3, respair.first, 5);
|
/* SubRequest& req3_sub1 = */ hist.add_subrequest(req3, respair.first, 5);
|
||||||
|
|
||||||
// add a request - Thread, time
|
// add a request - Thread, time
|
||||||
Request& req3bis = hist.add_request(p3_t1, 7);
|
Request& req3bis = hist.add_request(p3_t1, 7);
|
||||||
|
|
||||||
// add a sub request - Request, resource_key, duration, places
|
// add a sub request - Request, resource_key, duration, places
|
||||||
SubRequest& req3bis_sub1 = hist.add_subrequest(req3bis, respair.first, 5);
|
/* SubRequest& req3bis_sub1 = */ hist.add_subrequest(req3bis, respair.first, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -536,19 +536,16 @@ Glib::ustring get_schedulable_state_name(Schedulable::state st)
|
||||||
{
|
{
|
||||||
case Schedulable::state_running:
|
case Schedulable::state_running:
|
||||||
return Glib::ustring("Schedulable::state_running");
|
return Glib::ustring("Schedulable::state_running");
|
||||||
break;
|
|
||||||
case Schedulable::state_ready:
|
case Schedulable::state_ready:
|
||||||
return Glib::ustring("Schedulable::state_ready");
|
return Glib::ustring("Schedulable::state_ready");
|
||||||
break;
|
|
||||||
case Schedulable::state_blocked:
|
case Schedulable::state_blocked:
|
||||||
return Glib::ustring("Schedulable::state_blocked");
|
return Glib::ustring("Schedulable::state_blocked");
|
||||||
break;
|
|
||||||
case Schedulable::state_future:
|
case Schedulable::state_future:
|
||||||
return Glib::ustring("Schedulable::state_future");
|
return Glib::ustring("Schedulable::state_future");
|
||||||
break;
|
|
||||||
case Schedulable::state_terminated:
|
case Schedulable::state_terminated:
|
||||||
return Glib::ustring("Schedulable::state_terminated");
|
return Glib::ustring("Schedulable::state_terminated");
|
||||||
break;
|
default:
|
||||||
|
return Glib::ustring("Unhandled Schedulable::state!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,19 +555,16 @@ Glib::ustring get_request_state_name(Request::state st)
|
||||||
{
|
{
|
||||||
case Request::state_unallocable:
|
case Request::state_unallocable:
|
||||||
return Glib::ustring("state_unallocable");
|
return Glib::ustring("state_unallocable");
|
||||||
break;
|
|
||||||
case Request::state_allocated:
|
case Request::state_allocated:
|
||||||
return Glib::ustring("state_allocated");
|
return Glib::ustring("state_allocated");
|
||||||
break;
|
|
||||||
case Request::state_future:
|
case Request::state_future:
|
||||||
return Glib::ustring("state_future");
|
return Glib::ustring("state_future");
|
||||||
break;
|
|
||||||
case Request::state_exhausted:
|
case Request::state_exhausted:
|
||||||
return Glib::ustring("state_exhausted");
|
return Glib::ustring("state_exhausted");
|
||||||
break;
|
|
||||||
case Request::state_allocable:
|
case Request::state_allocable:
|
||||||
return Glib::ustring("state_allocable");
|
return Glib::ustring("state_allocable");
|
||||||
break;
|
default:
|
||||||
|
return Glib::ustring("Unhandled Request::state!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,13 +575,12 @@ Glib::ustring get_simulation_state_name(Simulation::state st)
|
||||||
{
|
{
|
||||||
case Simulation::state_running:
|
case Simulation::state_running:
|
||||||
return Glib::ustring("Simulation::state_running");
|
return Glib::ustring("Simulation::state_running");
|
||||||
break;
|
|
||||||
case Simulation::state_paused:
|
case Simulation::state_paused:
|
||||||
return Glib::ustring("Simulation::state_paused");
|
return Glib::ustring("Simulation::state_paused");
|
||||||
break;
|
|
||||||
case Simulation::state_stopped:
|
case Simulation::state_stopped:
|
||||||
return Glib::ustring("Simulation::state_stopped");
|
return Glib::ustring("Simulation::state_stopped");
|
||||||
break;
|
default:
|
||||||
|
return Glib::ustring("Unhandled Simulation state!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ using Glib::ustring;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int, char**)
|
||||||
{
|
{
|
||||||
// Set up Glib thread support
|
// Set up Glib thread support
|
||||||
Glib::thread_init();
|
Glib::thread_init();
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
// along with SGPEMv2. If not, see http://www.gnu.org/licenses/.
|
// along with SGPEMv2. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: refactor this file from the first line to the last line.
|
||||||
|
|
||||||
#include "text_simulation.hh"
|
#include "text_simulation.hh"
|
||||||
|
|
||||||
#include <sgpemv2/global_preferences.hh>
|
#include <sgpemv2/global_preferences.hh>
|
||||||
|
|
Loading…
Reference in New Issue