- Audited some other stuff
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1165 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
bd6e52f811
commit
7bcd220f89
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
#include "dynamic_resource.hh"
|
#include "dynamic_resource.hh"
|
||||||
#include "static_resource.hh"
|
#include "static_resource.hh"
|
||||||
#include <sgpemv2/serialize_visitor.hh>
|
|
||||||
|
|
||||||
|
#include <sgpemv2/serialize_visitor.hh>
|
||||||
#include <sgpemv2/templates/smartp.tcc>
|
#include <sgpemv2/templates/smartp.tcc>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -40,7 +40,6 @@ DynamicResource::operator==(const Resource& op2) const
|
||||||
return _static_resource == dynamic_cast<const DynamicResource&>(op2)._static_resource;
|
return _static_resource == dynamic_cast<const DynamicResource&>(op2)._static_resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Glib::ustring
|
Glib::ustring
|
||||||
DynamicResource::get_name() const
|
DynamicResource::get_name() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// src/backend/resource_policy_priority_inheritance.hh - Copyright 2005, 2006, University
|
// src/backend/sgpemv2/resource_policy_priority_inheritance.hh - Copyright 2005, 2006, University
|
||||||
// of Padova, dept. of Pure and Applied
|
// of Padova, dept. of Pure and Applied
|
||||||
// Mathematics
|
// Mathematics
|
||||||
//
|
//
|
||||||
|
@ -21,31 +21,33 @@
|
||||||
#ifndef RESOURCE_POLICY_INHERITANCE_HH
|
#ifndef RESOURCE_POLICY_INHERITANCE_HH
|
||||||
#define RESOURCE_POLICY_INHERITANCE_HH 1
|
#define RESOURCE_POLICY_INHERITANCE_HH 1
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "gettext.h"
|
|
||||||
|
|
||||||
#include "glibmm/ustring.h"
|
|
||||||
|
|
||||||
#include <sgpemv2/resource_policy.hh>
|
|
||||||
|
|
||||||
#include <sgpemv2/policy_parameters.hh>
|
|
||||||
#include <sgpemv2/user_interrupt_exception.hh>
|
|
||||||
|
|
||||||
namespace sgpem
|
namespace sgpem
|
||||||
{
|
{
|
||||||
class ResourcePolicyPriorityInheritance;
|
class ResourcePolicyPriorityInheritance;
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief
|
#include "config.h"
|
||||||
It's a Strategy wich stay for a resource allocating algorithm.
|
#include "gettext.h"
|
||||||
It implements the related resource allocation policy.
|
|
||||||
*/
|
#include <sgpemv2/resource_policy.hh>
|
||||||
|
#include <sgpemv2/policy_parameters.hh>
|
||||||
|
#include <sgpemv2/user_interrupt_exception.hh>
|
||||||
|
|
||||||
|
#include <glibmm/ustring.h>
|
||||||
|
|
||||||
|
namespace sgpem
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \brief It's a Strategy wich stay for a resource allocating algorithm.
|
||||||
|
* It implements the related resource allocation policy.
|
||||||
|
*/
|
||||||
class SG_DLLEXPORT ResourcePolicyPriorityInheritance : public ResourcePolicy
|
class SG_DLLEXPORT ResourcePolicyPriorityInheritance : public ResourcePolicy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ResourcePolicyPriorityInheritance();
|
virtual ~ResourcePolicyPriorityInheritance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the inner components of the policy.
|
\brief Initialize the inner components of the policy.
|
||||||
|
|
||||||
Because it's a pure virtual method, must be re-implemented
|
Because it's a pure virtual method, must be re-implemented
|
||||||
in concrete derived classes.
|
in concrete derived classes.
|
||||||
|
@ -53,15 +55,17 @@ namespace sgpem
|
||||||
virtual void configure() throw(UserInterruptException);
|
virtual void configure() throw(UserInterruptException);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Mixes the queues.
|
\brief Mixes the queues.
|
||||||
|
|
||||||
Because it's a pure virtual method, must be re-implemented
|
Because it's a pure virtual method, must be re-implemented
|
||||||
in concrete derived classes.
|
in concrete derived classes.
|
||||||
*/
|
*/
|
||||||
virtual void enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException);
|
virtual void enforce(Environment& environment,
|
||||||
|
Environment::SubRequestQueue& queue,
|
||||||
|
SubRequest& sr) throw(UserInterruptException);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets a string description of the policy.
|
\brief Gets a string description of the policy.
|
||||||
|
|
||||||
Because it's a pure virtual method, must be re-implemented
|
Because it's a pure virtual method, must be re-implemented
|
||||||
in concrete derived classes.
|
in concrete derived classes.
|
||||||
|
@ -76,7 +80,7 @@ namespace sgpem
|
||||||
virtual void deactivate();
|
virtual void deactivate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the parameters related with this policy.
|
\brief Gets the parameters related with this policy.
|
||||||
|
|
||||||
\return The policy parameters.
|
\return The policy parameters.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// src/backend/text_simulation.cc - Copyright 2005, 2006, University
|
// src/text_simulation.cc - Copyright 2005, 2006, University
|
||||||
// of Padova, dept. of Pure and Applied
|
// of Padova, dept. of Pure and Applied
|
||||||
// Mathematics
|
// Mathematics
|
||||||
//
|
//
|
||||||
|
@ -18,10 +18,10 @@
|
||||||
// along with SGPEMv2; if not, write to the Free Software
|
// along with SGPEMv2; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
#include "text_simulation.hh"
|
||||||
|
|
||||||
#include <sgpemv2/global_preferences.hh>
|
#include <sgpemv2/global_preferences.hh>
|
||||||
|
|
||||||
#include <sgpemv2/string_utils.hh>
|
#include <sgpemv2/string_utils.hh>
|
||||||
|
|
||||||
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
||||||
#include <sgpemv2/cpu_policy_manager.hh>
|
#include <sgpemv2/cpu_policy_manager.hh>
|
||||||
#include <sgpemv2/resource_policy.hh>
|
#include <sgpemv2/resource_policy.hh>
|
||||||
|
@ -39,10 +39,8 @@
|
||||||
#include <sgpemv2/sub_request.hh>
|
#include <sgpemv2/sub_request.hh>
|
||||||
#include <sgpemv2/ready_queue.hh>
|
#include <sgpemv2/ready_queue.hh>
|
||||||
#include <sgpemv2/statistics.hh>
|
#include <sgpemv2/statistics.hh>
|
||||||
|
|
||||||
#include <sgpemv2/templates/sequences.tcc>
|
#include <sgpemv2/templates/sequences.tcc>
|
||||||
|
#include <sgpemv2/templates/smartp.tcc>
|
||||||
#include "text_simulation.hh"
|
|
||||||
|
|
||||||
#include <glibmm/timer.h>
|
#include <glibmm/timer.h>
|
||||||
|
|
||||||
|
@ -51,16 +49,26 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace sgpem;
|
using namespace sgpem;
|
||||||
using Glib::Thread;
|
using Glib::Thread;
|
||||||
using Glib::ustring;
|
using Glib::ustring;
|
||||||
|
|
||||||
#include <sgpemv2/templates/smartp.tcc>
|
// overloaded operator for printing the state of
|
||||||
|
// a schedulable
|
||||||
|
static ostream&
|
||||||
|
operator<<(ostream& os, Schedulable::state state);
|
||||||
|
|
||||||
|
// overloaded operator for printing the state of
|
||||||
|
// a request/subrequest
|
||||||
|
static ostream&
|
||||||
|
operator<<(ostream& os, Request::state state);
|
||||||
|
|
||||||
namespace sgpem
|
namespace sgpem
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* \brief A class for a generic "parameter" object
|
||||||
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class CommandParameter
|
class CommandParameter
|
||||||
{
|
{
|
||||||
|
@ -73,11 +81,14 @@ namespace sgpem
|
||||||
|
|
||||||
CommandParameter(const PolicyParameters::Parameter<T>& pparam);
|
CommandParameter(const PolicyParameters::Parameter<T>& pparam);
|
||||||
|
|
||||||
|
// a textual description of the parameter
|
||||||
ustring description;
|
ustring description;
|
||||||
T low_bound;
|
T low_bound;
|
||||||
T up_bound;
|
T up_bound;
|
||||||
bool required;
|
bool required;
|
||||||
|
// default value for the parameter
|
||||||
T preset;
|
T preset;
|
||||||
|
// current value of the parameter
|
||||||
T value;
|
T value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,13 +145,14 @@ TextSimulation::unsaved_ask_confirm() const
|
||||||
p_stderr(_("WARNING: Simulation was not recently saved. "
|
p_stderr(_("WARNING: Simulation was not recently saved. "
|
||||||
"If you continue some changes to the simulation might be lost.\n"));
|
"If you continue some changes to the simulation might be lost.\n"));
|
||||||
|
|
||||||
|
// keep ascking the user until a correct response has been obtained
|
||||||
for (bool bad_arg = true; bad_arg;)
|
for (bool bad_arg = true; bad_arg;)
|
||||||
{
|
{
|
||||||
p_stdout(_("Continue? [y/n] "));
|
p_stdout(_("Continue? [y/n] "));
|
||||||
|
|
||||||
ustring buf = readline();
|
const ustring buf = readline();
|
||||||
|
|
||||||
Tokens tokens = tokenize(buf);
|
const Tokens tokens = tokenize(buf);
|
||||||
|
|
||||||
if (tokens.size() == 1 && tokens[0].size() == 1)
|
if (tokens.size() == 1 && tokens[0].size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +179,7 @@ TextSimulation::show(const Container& entities)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specializations need to go explicitly inside the namespace. why?
|
// Specializations need to go explicitly inside the namespace
|
||||||
namespace sgpem
|
namespace sgpem
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
|
@ -225,6 +237,7 @@ TextSimulation::get_parameter(CommandParameter<T>& parameter)
|
||||||
|
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
|
// print an asterisk before name of required parameters
|
||||||
if (parameter.required)
|
if (parameter.required)
|
||||||
buf << "*";
|
buf << "*";
|
||||||
|
|
||||||
|
@ -233,7 +246,7 @@ TextSimulation::get_parameter(CommandParameter<T>& parameter)
|
||||||
|
|
||||||
p_stdout(buf.str());
|
p_stdout(buf.str());
|
||||||
|
|
||||||
ustring input = readline();
|
const ustring input = readline();
|
||||||
|
|
||||||
T value;
|
T value;
|
||||||
|
|
||||||
|
@ -265,10 +278,11 @@ TextSimulation::get_parameter(CommandParameter<T>& parameter)
|
||||||
correct = false;
|
correct = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// keep looping until the input is in a correct format
|
||||||
while (!correct);
|
while (!correct);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specializations need to go explicitly inside the namespace. why?
|
// Specializations need to go explicitly inside the namespace
|
||||||
namespace sgpem
|
namespace sgpem
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
|
@ -277,6 +291,8 @@ namespace sgpem
|
||||||
{
|
{
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
|
|
||||||
|
// will loop until at least a nonwhite character is typed
|
||||||
|
// for a required parameter
|
||||||
while (loop)
|
while (loop)
|
||||||
{
|
{
|
||||||
ustring buf;
|
ustring buf;
|
||||||
|
@ -289,7 +305,7 @@ namespace sgpem
|
||||||
|
|
||||||
buf = readline();
|
buf = readline();
|
||||||
|
|
||||||
Tokens tokens = tokenize(buf);
|
const Tokens tokens = tokenize(buf);
|
||||||
|
|
||||||
if (tokens.size() == 0 && parameter.required)
|
if (tokens.size() == 0 && parameter.required)
|
||||||
p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n"));
|
p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n"));
|
||||||
|
@ -321,10 +337,11 @@ namespace sgpem
|
||||||
|
|
||||||
p_stdout(buf.str());
|
p_stdout(buf.str());
|
||||||
|
|
||||||
ustring str = readline();
|
const ustring str = readline();
|
||||||
|
|
||||||
Tokens tokens = tokenize(str);
|
const Tokens tokens = tokenize(str);
|
||||||
|
|
||||||
|
// there are nonwhite characters on the input
|
||||||
if (tokens.size() != 0)
|
if (tokens.size() != 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -337,12 +354,14 @@ namespace sgpem
|
||||||
correct = false;
|
correct = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// input is empty. check if required
|
||||||
else if (parameter.required)
|
else if (parameter.required)
|
||||||
{
|
{
|
||||||
p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n"));
|
p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n"));
|
||||||
correct = false;
|
correct = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// keep looping until input is correct
|
||||||
while (!correct);
|
while (!correct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,13 +377,14 @@ TextSimulation::on_run(const Tokens& arguments)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Simulation& sim = Simulation::get_instance();
|
Simulation& sim = Simulation::get_instance();
|
||||||
|
|
||||||
switch(sim.get_mode())
|
switch(sim.get_mode())
|
||||||
{
|
{
|
||||||
case Simulation::mode_step_by_step:
|
case Simulation::mode_step_by_step:
|
||||||
sim.run();
|
sim.run();
|
||||||
break;
|
break;
|
||||||
case Simulation::mode_continuous:
|
case Simulation::mode_continuous:
|
||||||
int interval = GlobalPreferences::get_instance().get_speed() * 1000;
|
int interval = GlobalPreferences::get_instance().get_speed() * 1000;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sim.run();
|
sim.run();
|
||||||
|
@ -388,6 +408,7 @@ TextSimulation::on_run(const Tokens& arguments)
|
||||||
"the current policy will be deactivated\n"));
|
"the current policy will be deactivated\n"));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// policy is malformed. attempting to unset it
|
||||||
Simulation::get_instance().set_policy(NULL);
|
Simulation::get_instance().set_policy(NULL);
|
||||||
}
|
}
|
||||||
catch(const CPUPolicyException& f)
|
catch(const CPUPolicyException& f)
|
||||||
|
@ -429,20 +450,22 @@ TextSimulation::on_jumpto(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Listen for updates only during scheduling
|
// string containing the destination of jumpto
|
||||||
|
const ustring _position = arguments[0];
|
||||||
ustring _position = arguments[0];
|
|
||||||
|
|
||||||
|
// destination position on the history
|
||||||
History::position p;
|
History::position p;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pos = string_to<int>(_position) + 1;
|
const int pos = string_to<int>(_position) + 1;
|
||||||
if (pos < 0)
|
|
||||||
{
|
if (pos < 0)
|
||||||
p_stderr(_("ERROR: provided instant is out of range.\n"));
|
{
|
||||||
return;
|
p_stderr(_("ERROR: provided instant is out of range.\n"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
p = static_cast<unsigned int>(pos);
|
p = static_cast<unsigned int>(pos);
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -476,6 +499,7 @@ TextSimulation::on_jumpto(const Tokens& arguments)
|
||||||
"the current policy will be deactivated\n"));
|
"the current policy will be deactivated\n"));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// policy is malformed. attempting to unset it
|
||||||
Simulation::get_instance().set_policy(NULL);
|
Simulation::get_instance().set_policy(NULL);
|
||||||
}
|
}
|
||||||
catch(const CPUPolicyException& f)
|
catch(const CPUPolicyException& f)
|
||||||
|
@ -525,7 +549,8 @@ TextSimulation::configure_policy(PolicyType& policy)
|
||||||
IntParams int_params = parameters.get_registered_int_parameters();
|
IntParams int_params = parameters.get_registered_int_parameters();
|
||||||
FloatParams float_params = parameters.get_registered_float_parameters();
|
FloatParams float_params = parameters.get_registered_float_parameters();
|
||||||
StringParams string_params = parameters.get_registered_string_parameters();
|
StringParams string_params = parameters.get_registered_string_parameters();
|
||||||
|
|
||||||
|
// check there is at least a parameter to configure
|
||||||
if(int_params.size() > 0 || float_params.size() > 0 || string_params.size() > 0)
|
if(int_params.size() > 0 || float_params.size() > 0 || string_params.size() > 0)
|
||||||
{
|
{
|
||||||
p_stdout(_("Please provide a value for each attribute:\n"));
|
p_stdout(_("Please provide a value for each attribute:\n"));
|
||||||
|
@ -553,7 +578,6 @@ TextSimulation::configure_policy(PolicyType& policy)
|
||||||
// I tried solving this issue by using templates, but to make
|
// I tried solving this issue by using templates, but to make
|
||||||
// it work will require adding to PolicyParameters a member template
|
// it work will require adding to PolicyParameters a member template
|
||||||
// method with 2 specializations...
|
// method with 2 specializations...
|
||||||
|
|
||||||
|
|
||||||
if(float_params.size() > 0)
|
if(float_params.size() > 0)
|
||||||
p_stdout(_("\nFloating-point arguments:\n"));
|
p_stdout(_("\nFloating-point arguments:\n"));
|
||||||
|
@ -595,7 +619,7 @@ TextSimulation::on_configure(const Tokens& arguments)
|
||||||
if(!check_arguments_num(arguments, 1))
|
if(!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring what = arguments[0];
|
const ustring what = arguments[0];
|
||||||
|
|
||||||
if(what == "cpu-policy")
|
if(what == "cpu-policy")
|
||||||
{
|
{
|
||||||
|
@ -717,6 +741,7 @@ TextSimulation::on_quit(const Tokens& arguments)
|
||||||
{
|
{
|
||||||
check_arguments_num(arguments, 0);
|
check_arguments_num(arguments, 0);
|
||||||
|
|
||||||
|
// check the user is sure of what he's doing
|
||||||
if (!unsaved_ask_confirm())
|
if (!unsaved_ask_confirm())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -732,7 +757,7 @@ TextSimulation::on_get(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring attr = arguments[0].uppercase();
|
const ustring attr = arguments[0].uppercase();
|
||||||
|
|
||||||
if (attr == "SIMULATION-TICK")
|
if (attr == "SIMULATION-TICK")
|
||||||
{
|
{
|
||||||
|
@ -777,6 +802,7 @@ policy_from_index(const Glib::ustring& value) throw(domain_error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no policy found, index was out of range
|
||||||
throw domain_error("");
|
throw domain_error("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,10 +816,12 @@ TextSimulation::on_set(const Tokens& arguments)
|
||||||
else if (!check_arguments_num(arguments, 2))
|
else if (!check_arguments_num(arguments, 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring attr = arguments[0].uppercase();
|
const ustring attr = arguments[0].uppercase();
|
||||||
|
|
||||||
ustring value;
|
ustring value;
|
||||||
|
|
||||||
|
// if there is the assignment operator, take the second token,
|
||||||
|
// otherwise the first
|
||||||
if (arguments[1] == "=")
|
if (arguments[1] == "=")
|
||||||
value = arguments[2];
|
value = arguments[2];
|
||||||
else
|
else
|
||||||
|
@ -803,7 +831,7 @@ TextSimulation::on_set(const Tokens& arguments)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int timer = string_to<int>(value);
|
const int timer = string_to<int>(value);
|
||||||
|
|
||||||
if (timer < 0)
|
if (timer < 0)
|
||||||
throw domain_error("");
|
throw domain_error("");
|
||||||
|
@ -825,9 +853,6 @@ TextSimulation::on_set(const Tokens& arguments)
|
||||||
Simulation::get_instance().set_policy(&p);
|
Simulation::get_instance().set_policy(&p);
|
||||||
p_stdout("\n");
|
p_stdout("\n");
|
||||||
p_stdout(p.get_name() + _(" scheduling policy selected.\n"));
|
p_stdout(p.get_name() + _(" scheduling policy selected.\n"));
|
||||||
|
|
||||||
//ResourcePolicyManager & rpm = *ResourcePoliciesGatekeeper::get_instance().get_registered().at(0);
|
|
||||||
//Simulation::get_instance().set_resource_policy(rpm.get_avail_policies().at(0));
|
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
{
|
{
|
||||||
|
@ -893,7 +918,7 @@ TextSimulation::on_show(const Tokens& arguments)
|
||||||
//make a local copy which we'll probably modify
|
//make a local copy which we'll probably modify
|
||||||
Tokens args = arguments;
|
Tokens args = arguments;
|
||||||
|
|
||||||
ustring entities = args[0].uppercase();
|
const ustring entities = args[0].uppercase();
|
||||||
args.erase(args.begin());
|
args.erase(args.begin());
|
||||||
|
|
||||||
typedef void (TextSimulation::*f_ptr)(const Tokens&);
|
typedef void (TextSimulation::*f_ptr)(const Tokens&);
|
||||||
|
@ -942,7 +967,7 @@ TextSimulation::on_show_threads(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -951,7 +976,7 @@ TextSimulation::on_show_threads(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
threads = processes.at(pid)->get_threads();
|
threads = processes.at(pid)->get_threads();
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -975,8 +1000,8 @@ TextSimulation::on_show_requests(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 2))
|
if (!check_arguments_num(arguments, 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -984,10 +1009,10 @@ TextSimulation::on_show_requests(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
requests = threads.at(tid)->get_requests();
|
requests = threads.at(tid)->get_requests();
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -1010,9 +1035,9 @@ TextSimulation::on_show_subrequests(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 3))
|
if (!check_arguments_num(arguments, 3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
ustring request = arguments[2];
|
const ustring request = arguments[2];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1020,12 +1045,12 @@ TextSimulation::on_show_subrequests(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
int rid = string_to<int>(request) - 1;
|
const int rid = string_to<int>(request) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
vector<Request*> requests = threads.at(tid)->get_requests();
|
const vector<Request*> requests = threads.at(tid)->get_requests();
|
||||||
subrequests = requests.at(rid)->get_subrequests();
|
subrequests = requests.at(rid)->get_subrequests();
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -1087,7 +1112,7 @@ TextSimulation::on_show_statistics(const Tokens& arguments)
|
||||||
{
|
{
|
||||||
check_arguments_num(arguments, 0);
|
check_arguments_num(arguments, 0);
|
||||||
|
|
||||||
unsigned int front = Simulation::get_instance().get_history().get_front();
|
const unsigned int front = Simulation::get_instance().get_history().get_front();
|
||||||
Statistics::get_instance().calculateStatisticsAt(front);
|
Statistics::get_instance().calculateStatisticsAt(front);
|
||||||
const SimulationStatistics* sim = Statistics::get_instance().get_simulation_statistics();
|
const SimulationStatistics* sim = Statistics::get_instance().get_simulation_statistics();
|
||||||
|
|
||||||
|
@ -1125,7 +1150,7 @@ TextSimulation::on_add(const Tokens& arguments)
|
||||||
//make a local copy which we'll probably modify
|
//make a local copy which we'll probably modify
|
||||||
Tokens args = arguments;
|
Tokens args = arguments;
|
||||||
|
|
||||||
ustring entity = args[0].uppercase();
|
const ustring entity = args[0].uppercase();
|
||||||
args.erase(args.begin());
|
args.erase(args.begin());
|
||||||
|
|
||||||
typedef void (TextSimulation::*f_ptr)(const Tokens&);
|
typedef void (TextSimulation::*f_ptr)(const Tokens&);
|
||||||
|
@ -1183,7 +1208,7 @@ TextSimulation::on_add_thread(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1227,8 +1252,8 @@ TextSimulation::on_add_request(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 2))
|
if (!check_arguments_num(arguments, 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1237,10 +1262,10 @@ TextSimulation::on_add_request(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
t = threads.at(tid);
|
t = threads.at(tid);
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -1269,9 +1294,9 @@ TextSimulation::on_add_subrequest(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 3))
|
if (!check_arguments_num(arguments, 3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
ustring request = arguments[2];
|
const ustring request = arguments[2];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1280,12 +1305,12 @@ TextSimulation::on_add_subrequest(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
int rid = string_to<int>(request) - 1;
|
const int rid = string_to<int>(request) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
vector<Request*> requests = threads.at(tid)->get_requests();
|
const vector<Request*> requests = threads.at(tid)->get_requests();
|
||||||
r = requests.at(rid);
|
r = requests.at(rid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1337,7 +1362,7 @@ TextSimulation::on_remove(const Tokens& arguments)
|
||||||
//make a local copy which we'll probably modify
|
//make a local copy which we'll probably modify
|
||||||
Tokens args = arguments;
|
Tokens args = arguments;
|
||||||
|
|
||||||
ustring entity = args[0].uppercase();
|
const ustring entity = args[0].uppercase();
|
||||||
args.erase(args.begin());
|
args.erase(args.begin());
|
||||||
|
|
||||||
typedef void (TextSimulation::*f_ptr)(const Tokens&);
|
typedef void (TextSimulation::*f_ptr)(const Tokens&);
|
||||||
|
@ -1361,7 +1386,7 @@ TextSimulation::on_remove_process(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1393,7 +1418,7 @@ TextSimulation::on_remove_resource(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring resource = arguments[0];
|
const ustring resource = arguments[0];
|
||||||
|
|
||||||
History& h = Simulation::get_instance().get_history();
|
History& h = Simulation::get_instance().get_history();
|
||||||
|
|
||||||
|
@ -1429,8 +1454,8 @@ TextSimulation::on_remove_thread(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 2))
|
if (!check_arguments_num(arguments, 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1439,10 +1464,10 @@ TextSimulation::on_remove_thread(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
t = threads.at(tid);
|
t = threads.at(tid);
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -1466,9 +1491,9 @@ TextSimulation::on_remove_request(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 3))
|
if (!check_arguments_num(arguments, 3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
ustring request = arguments[2];
|
const ustring request = arguments[2];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1477,12 +1502,12 @@ TextSimulation::on_remove_request(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
int rid = string_to<int>(request) - 1;
|
const int rid = string_to<int>(request) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
vector<Request*> requests = threads.at(tid)->get_requests();
|
const vector<Request*> requests = threads.at(tid)->get_requests();
|
||||||
r = requests.at(rid);
|
r = requests.at(rid);
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -1506,10 +1531,10 @@ TextSimulation::on_remove_subrequest(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 4))
|
if (!check_arguments_num(arguments, 4))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring process = arguments[0];
|
const ustring process = arguments[0];
|
||||||
ustring thread = arguments[1];
|
const ustring thread = arguments[1];
|
||||||
ustring request = arguments[2];
|
const ustring request = arguments[2];
|
||||||
ustring subrequest = arguments[3];
|
const ustring subrequest = arguments[3];
|
||||||
|
|
||||||
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
const Environment& env = Simulation::get_instance().get_history().get_environment_at(0);
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
|
@ -1518,14 +1543,14 @@ TextSimulation::on_remove_subrequest(const Tokens& arguments)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int pid = string_to<int>(process) - 1;
|
const int pid = string_to<int>(process) - 1;
|
||||||
int tid = string_to<int>(thread) - 1;
|
const int tid = string_to<int>(thread) - 1;
|
||||||
int rid = string_to<int>(request) - 1;
|
const int rid = string_to<int>(request) - 1;
|
||||||
int srid = string_to<int>(subrequest) - 1;
|
const int srid = string_to<int>(subrequest) - 1;
|
||||||
|
|
||||||
vector<Thread*> threads = processes.at(pid)->get_threads();
|
const vector<Thread*> threads = processes.at(pid)->get_threads();
|
||||||
vector<Request*> requests = threads.at(tid)->get_requests();
|
const vector<Request*> requests = threads.at(tid)->get_requests();
|
||||||
vector<SubRequest*> subrequests = requests.at(rid)->get_subrequests();
|
const vector<SubRequest*> subrequests = requests.at(rid)->get_subrequests();
|
||||||
r = subrequests.at(srid);
|
r = subrequests.at(srid);
|
||||||
}
|
}
|
||||||
catch (domain_error e)
|
catch (domain_error e)
|
||||||
|
@ -1549,11 +1574,11 @@ TextSimulation::on_save(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring filename = arguments[0];
|
const ustring filename = arguments[0];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vector<Serializer*> serializers =
|
const vector<Serializer*> serializers =
|
||||||
SerializersGatekeeper::get_instance().get_registered();
|
SerializersGatekeeper::get_instance().get_registered();
|
||||||
|
|
||||||
// FIXME using the first serializer available, this
|
// FIXME using the first serializer available, this
|
||||||
|
@ -1585,14 +1610,14 @@ TextSimulation::on_load(const Tokens& arguments)
|
||||||
if (!check_arguments_num(arguments, 1))
|
if (!check_arguments_num(arguments, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ustring filename = arguments[0];
|
const ustring filename = arguments[0];
|
||||||
|
|
||||||
if (!unsaved_ask_confirm())
|
if (!unsaved_ask_confirm())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vector<Serializer*> serializers =
|
const vector<Serializer*> serializers =
|
||||||
SerializersGatekeeper::get_instance().get_registered();
|
SerializersGatekeeper::get_instance().get_registered();
|
||||||
|
|
||||||
// FIXME using the first serializer available, this
|
// FIXME using the first serializer available, this
|
||||||
|
@ -1750,13 +1775,11 @@ TextSimulation::update(const Simulation& changed_simulation)
|
||||||
int printed_instant;
|
int printed_instant;
|
||||||
static const std::string tab = " ";
|
static const std::string tab = " ";
|
||||||
|
|
||||||
|
|
||||||
// Print header for each instant:
|
// Print header for each instant:
|
||||||
printed_instant = static_cast<int>(changed_simulation.get_history().get_front()) - 1;
|
printed_instant = static_cast<int>(changed_simulation.get_history().get_front()) - 1;
|
||||||
|
|
||||||
oss << endl << ">>>> " << printed_instant;
|
oss << endl << ">>>> " << printed_instant;
|
||||||
|
|
||||||
|
|
||||||
// Print ready queue
|
// Print ready queue
|
||||||
oss << endl << _("READY QUEUE: { ");
|
oss << endl << _("READY QUEUE: { ");
|
||||||
|
|
||||||
|
@ -1771,23 +1794,20 @@ TextSimulation::update(const Simulation& changed_simulation)
|
||||||
|
|
||||||
oss << _("}") << endl;
|
oss << _("}") << endl;
|
||||||
|
|
||||||
|
|
||||||
// Flush buffer to screen
|
// Flush buffer to screen
|
||||||
p_stdout(oss.str());
|
p_stdout(oss.str());
|
||||||
oss.str(string());
|
oss.str(string());
|
||||||
|
|
||||||
|
|
||||||
const Environment::Resources& resources = env.get_resources();
|
const Environment::Resources& resources = env.get_resources();
|
||||||
const Environment::Processes& processes = env.get_processes();
|
const Environment::Processes& processes = env.get_processes();
|
||||||
typedef Environment::Resources::const_iterator ResourceIt;
|
typedef Environment::Resources::const_iterator ResourceIt;
|
||||||
|
|
||||||
|
|
||||||
// Write the queue of requests for each resource
|
// Write the queue of requests for each resource
|
||||||
oss << _("RESOURCES:") << endl;
|
oss << _("RESOURCES:") << endl;
|
||||||
for (ResourceIt it = resources.begin(); it != resources.end(); ++it)
|
for (ResourceIt it = resources.begin(); it != resources.end(); ++it)
|
||||||
{
|
{
|
||||||
const Resource& r = *it->second;
|
const Resource& r = *it->second;
|
||||||
Environment::resource_key_t key = it->first;
|
const Environment::resource_key_t key = it->first;
|
||||||
|
|
||||||
oss << right << setw(3) << key << left << ". " << r.get_name() << _(", with ");
|
oss << right << setw(3) << key << left << ". " << r.get_name() << _(", with ");
|
||||||
oss << r.get_places() << _(" places") << endl;
|
oss << r.get_places() << _(" places") << endl;
|
||||||
|
@ -1817,20 +1837,21 @@ TextSimulation::update(const Simulation& changed_simulation)
|
||||||
// Flush buffer to screen
|
// Flush buffer to screen
|
||||||
p_stdout(oss.str());
|
p_stdout(oss.str());
|
||||||
oss.str(string());
|
oss.str(string());
|
||||||
|
|
||||||
|
|
||||||
// Set new format fillers
|
// Set new format fillers
|
||||||
static const unsigned int fill0 = 25;
|
static const unsigned int fill0 = 25;
|
||||||
static const unsigned int fill1 = 15;
|
static const unsigned int fill1 = 15;
|
||||||
|
|
||||||
// Minimum fill0 for the usage we make of it below:
|
// Minimum fill0 for the usage we make of it below:
|
||||||
assert(fill0 > tab.size()*2 + 6);
|
assert(fill0 > tab.size() * 2 + 6);
|
||||||
|
|
||||||
oss << endl;
|
oss << endl;
|
||||||
|
|
||||||
|
// Print display header
|
||||||
|
|
||||||
oss << left;
|
oss << left;
|
||||||
oss << setw(fill0) << _("PROCESSES:");
|
oss << setw(fill0) << _("PROCESSES:");
|
||||||
oss << right;
|
oss << right;
|
||||||
oss << setw(fill1) << _("state")
|
oss << setw(fill1) << _("state")
|
||||||
<< setw(fill1) << _("arrival")
|
<< setw(fill1) << _("arrival")
|
||||||
<< setw(fill1) << _("requiring")
|
<< setw(fill1) << _("requiring")
|
||||||
|
@ -1839,8 +1860,12 @@ TextSimulation::update(const Simulation& changed_simulation)
|
||||||
<< setw(fill1) << _("resource_id")
|
<< setw(fill1) << _("resource_id")
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
// Display information for each schedulable/request in a tabular format
|
||||||
|
|
||||||
for (unsigned int pi = 0; pi < processes.size(); ++pi)
|
for (unsigned int pi = 0; pi < processes.size(); ++pi)
|
||||||
{
|
{
|
||||||
|
// Display process
|
||||||
|
|
||||||
Process& p = *processes[pi];
|
Process& p = *processes[pi];
|
||||||
oss << setw(2) << right << (pi + 1) << left << ". "
|
oss << setw(2) << right << (pi + 1) << left << ". "
|
||||||
<< setw(fill0 - 4) << p.get_name().substr(0, fill0 - 5);
|
<< setw(fill0 - 4) << p.get_name().substr(0, fill0 - 5);
|
||||||
|
@ -1855,7 +1880,9 @@ TextSimulation::update(const Simulation& changed_simulation)
|
||||||
p_stdout(oss.str());
|
p_stdout(oss.str());
|
||||||
oss.str(string());
|
oss.str(string());
|
||||||
|
|
||||||
vector<Thread*> threads = p.get_threads();
|
// Display threads
|
||||||
|
|
||||||
|
const vector<Thread*> threads = p.get_threads();
|
||||||
|
|
||||||
for (unsigned int ti = 0; ti < threads.size(); ++ti)
|
for (unsigned int ti = 0; ti < threads.size(); ++ti)
|
||||||
{
|
{
|
||||||
|
@ -1879,27 +1906,31 @@ TextSimulation::update(const Simulation& changed_simulation)
|
||||||
p_stdout(oss.str());
|
p_stdout(oss.str());
|
||||||
oss.str(string());
|
oss.str(string());
|
||||||
|
|
||||||
vector<Request*> requests = t.get_requests();
|
// Display requests
|
||||||
|
|
||||||
|
const vector<Request*> requests = t.get_requests();
|
||||||
|
|
||||||
for (unsigned int ri = 0; ri < requests.size(); ++ri)
|
for (unsigned int ri = 0; ri < requests.size(); ++ri)
|
||||||
{
|
{
|
||||||
Request& r = *requests[ri];
|
Request& r = *requests[ri];
|
||||||
|
|
||||||
vector<SubRequest*> subrequests = r.get_subrequests();
|
// Display subrequests
|
||||||
|
|
||||||
|
const vector<SubRequest*> subrequests = r.get_subrequests();
|
||||||
|
|
||||||
for (unsigned int sri = 0; sri < subrequests.size(); ++sri)
|
for (unsigned int sri = 0; sri < subrequests.size(); ++sri)
|
||||||
{
|
{
|
||||||
SubRequest& sr = *subrequests[sri];
|
SubRequest& sr = *subrequests[sri];
|
||||||
ResourceIt point = resources.find(sr.get_resource_key());
|
ResourceIt point = resources.find(sr.get_resource_key());
|
||||||
|
|
||||||
oss << setw(2 + tab.size()*2) << ri + 1 << left << "." << setw(2) << sri + 1
|
oss << setw(2 + tab.size() * 2) << ri + 1 << left << "." << setw(2) << sri + 1
|
||||||
<< setw(fill0 - 5 - tab.size()*2) << (point->second)->get_name().substr(0, fill0 - 6 - tab.size()*2);
|
<< setw(fill0 - 5 - tab.size() * 2) << (point->second)->get_name().substr(0, fill0 - 6 - tab.size() * 2);
|
||||||
oss << right;
|
oss << right;
|
||||||
oss << setw(fill1) << sr.get_state();
|
oss << setw(fill1) << sr.get_state();
|
||||||
oss << setw(fill1) << r.get_instant();
|
oss << setw(fill1) << r.get_instant();
|
||||||
oss << setw(fill1) << sr.get_length();
|
oss << setw(fill1) << sr.get_length();
|
||||||
oss << setw(fill1) << sr.get_length() - sr.get_remaining_time();
|
oss << setw(fill1) << sr.get_length() - sr.get_remaining_time();
|
||||||
oss << setw(fill1*2) << sr.get_resource_key();
|
oss << setw(fill1 * 2) << sr.get_resource_key();
|
||||||
oss << endl;
|
oss << endl;
|
||||||
|
|
||||||
p_stdout(oss.str());
|
p_stdout(oss.str());
|
||||||
|
|
Loading…
Reference in New Issue