diff --git a/src/backend/dynamic_resource.cc b/src/backend/dynamic_resource.cc index 21321bc..99f0e5c 100644 --- a/src/backend/dynamic_resource.cc +++ b/src/backend/dynamic_resource.cc @@ -20,8 +20,8 @@ #include "dynamic_resource.hh" #include "static_resource.hh" -#include +#include #include #include @@ -40,7 +40,6 @@ DynamicResource::operator==(const Resource& op2) const return _static_resource == dynamic_cast(op2)._static_resource; } - Glib::ustring DynamicResource::get_name() const { diff --git a/src/backend/sgpemv2/resource_policy_priority_inheritance.hh b/src/backend/sgpemv2/resource_policy_priority_inheritance.hh index b07cf85..28c3c3b 100644 --- a/src/backend/sgpemv2/resource_policy_priority_inheritance.hh +++ b/src/backend/sgpemv2/resource_policy_priority_inheritance.hh @@ -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 // Mathematics // @@ -21,31 +21,33 @@ #ifndef RESOURCE_POLICY_INHERITANCE_HH #define RESOURCE_POLICY_INHERITANCE_HH 1 -#include "config.h" -#include "gettext.h" - -#include "glibmm/ustring.h" - -#include - -#include -#include - namespace sgpem { class ResourcePolicyPriorityInheritance; +} - /** \brief - It's a Strategy wich stay for a resource allocating algorithm. - It implements the related resource allocation policy. - */ +#include "config.h" +#include "gettext.h" + +#include +#include +#include + +#include + +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 { public: 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 in concrete derived classes. @@ -53,15 +55,17 @@ namespace sgpem virtual void configure() throw(UserInterruptException); /** - Mixes the queues. + \brief Mixes the queues. Because it's a pure virtual method, must be re-implemented 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 in concrete derived classes. @@ -76,7 +80,7 @@ namespace sgpem virtual void deactivate(); /** - Gets the parameters related with this policy. + \brief Gets the parameters related with this policy. \return The policy parameters. */ diff --git a/src/text_simulation.cc b/src/text_simulation.cc index 102b7b3..7b4f668 100644 --- a/src/text_simulation.cc +++ b/src/text_simulation.cc @@ -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 // Mathematics // @@ -18,10 +18,10 @@ // along with SGPEMv2; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#include "text_simulation.hh" + #include - #include - #include #include #include @@ -39,10 +39,8 @@ #include #include #include - #include - -#include "text_simulation.hh" +#include #include @@ -51,16 +49,26 @@ #include #include - using namespace std; using namespace sgpem; using Glib::Thread; using Glib::ustring; -#include +// 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 { + /** + * \brief A class for a generic "parameter" object + */ template class CommandParameter { @@ -73,11 +81,14 @@ namespace sgpem CommandParameter(const PolicyParameters::Parameter& pparam); + // a textual description of the parameter ustring description; T low_bound; T up_bound; bool required; + // default value for the parameter T preset; + // current value of the parameter T value; }; @@ -134,13 +145,14 @@ TextSimulation::unsaved_ask_confirm() const p_stderr(_("WARNING: Simulation was not recently saved. " "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;) { 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) { @@ -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 { template <> @@ -225,6 +237,7 @@ TextSimulation::get_parameter(CommandParameter& parameter) ostringstream buf; + // print an asterisk before name of required parameters if (parameter.required) buf << "*"; @@ -233,7 +246,7 @@ TextSimulation::get_parameter(CommandParameter& parameter) p_stdout(buf.str()); - ustring input = readline(); + const ustring input = readline(); T value; @@ -265,10 +278,11 @@ TextSimulation::get_parameter(CommandParameter& parameter) correct = false; } } + // keep looping until the input is in a correct format while (!correct); } -// Specializations need to go explicitly inside the namespace. why? +// Specializations need to go explicitly inside the namespace namespace sgpem { template <> @@ -277,6 +291,8 @@ namespace sgpem { bool loop = true; + // will loop until at least a nonwhite character is typed + // for a required parameter while (loop) { ustring buf; @@ -289,7 +305,7 @@ namespace sgpem buf = readline(); - Tokens tokens = tokenize(buf); + const Tokens tokens = tokenize(buf); if (tokens.size() == 0 && parameter.required) 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()); - 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) { try @@ -337,12 +354,14 @@ namespace sgpem correct = false; } } + // input is empty. check if required else if (parameter.required) { p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n")); correct = false; } } + // keep looping until input is correct while (!correct); } } @@ -358,13 +377,14 @@ TextSimulation::on_run(const Tokens& arguments) try { Simulation& sim = Simulation::get_instance(); + switch(sim.get_mode()) { case Simulation::mode_step_by_step: sim.run(); break; case Simulation::mode_continuous: - int interval = GlobalPreferences::get_instance().get_speed() * 1000; + int interval = GlobalPreferences::get_instance().get_speed() * 1000; do { sim.run(); @@ -388,6 +408,7 @@ TextSimulation::on_run(const Tokens& arguments) "the current policy will be deactivated\n")); try { + // policy is malformed. attempting to unset it Simulation::get_instance().set_policy(NULL); } catch(const CPUPolicyException& f) @@ -429,20 +450,22 @@ TextSimulation::on_jumpto(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - // Listen for updates only during scheduling - - ustring _position = arguments[0]; + // string containing the destination of jumpto + const ustring _position = arguments[0]; + // destination position on the history History::position p; try { - int pos = string_to(_position) + 1; - if (pos < 0) - { - p_stderr(_("ERROR: provided instant is out of range.\n")); - return; - } + const int pos = string_to(_position) + 1; + + if (pos < 0) + { + p_stderr(_("ERROR: provided instant is out of range.\n")); + return; + } + p = static_cast(pos); } catch (domain_error e) @@ -476,6 +499,7 @@ TextSimulation::on_jumpto(const Tokens& arguments) "the current policy will be deactivated\n")); try { + // policy is malformed. attempting to unset it Simulation::get_instance().set_policy(NULL); } catch(const CPUPolicyException& f) @@ -525,7 +549,8 @@ TextSimulation::configure_policy(PolicyType& policy) IntParams int_params = parameters.get_registered_int_parameters(); FloatParams float_params = parameters.get_registered_float_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) { 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 // it work will require adding to PolicyParameters a member template // method with 2 specializations... - if(float_params.size() > 0) p_stdout(_("\nFloating-point arguments:\n")); @@ -595,7 +619,7 @@ TextSimulation::on_configure(const Tokens& arguments) if(!check_arguments_num(arguments, 1)) return; - ustring what = arguments[0]; + const ustring what = arguments[0]; if(what == "cpu-policy") { @@ -717,6 +741,7 @@ TextSimulation::on_quit(const Tokens& arguments) { check_arguments_num(arguments, 0); + // check the user is sure of what he's doing if (!unsaved_ask_confirm()) return; @@ -732,7 +757,7 @@ TextSimulation::on_get(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring attr = arguments[0].uppercase(); + const ustring attr = arguments[0].uppercase(); 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(""); } @@ -790,10 +816,12 @@ TextSimulation::on_set(const Tokens& arguments) else if (!check_arguments_num(arguments, 2)) return; - ustring attr = arguments[0].uppercase(); + const ustring attr = arguments[0].uppercase(); ustring value; + // if there is the assignment operator, take the second token, + // otherwise the first if (arguments[1] == "=") value = arguments[2]; else @@ -803,7 +831,7 @@ TextSimulation::on_set(const Tokens& arguments) { try { - int timer = string_to(value); + const int timer = string_to(value); if (timer < 0) throw domain_error(""); @@ -825,9 +853,6 @@ TextSimulation::on_set(const Tokens& arguments) Simulation::get_instance().set_policy(&p); p_stdout("\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) { @@ -893,7 +918,7 @@ TextSimulation::on_show(const Tokens& arguments) //make a local copy which we'll probably modify Tokens args = arguments; - ustring entities = args[0].uppercase(); + const ustring entities = args[0].uppercase(); args.erase(args.begin()); typedef void (TextSimulation::*f_ptr)(const Tokens&); @@ -942,7 +967,7 @@ TextSimulation::on_show_threads(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring process = arguments[0]; + const ustring process = arguments[0]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -951,7 +976,7 @@ TextSimulation::on_show_threads(const Tokens& arguments) try { - int pid = string_to(process) - 1; + const int pid = string_to(process) - 1; threads = processes.at(pid)->get_threads(); } catch (domain_error e) @@ -975,8 +1000,8 @@ TextSimulation::on_show_requests(const Tokens& arguments) if (!check_arguments_num(arguments, 2)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -984,10 +1009,10 @@ TextSimulation::on_show_requests(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; - vector threads = processes.at(pid)->get_threads(); + const vector threads = processes.at(pid)->get_threads(); requests = threads.at(tid)->get_requests(); } catch (domain_error e) @@ -1010,9 +1035,9 @@ TextSimulation::on_show_subrequests(const Tokens& arguments) if (!check_arguments_num(arguments, 3)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; - ustring request = arguments[2]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; + const ustring request = arguments[2]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1020,12 +1045,12 @@ TextSimulation::on_show_subrequests(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; - int rid = string_to(request) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; + const int rid = string_to(request) - 1; - vector threads = processes.at(pid)->get_threads(); - vector requests = threads.at(tid)->get_requests(); + const vector threads = processes.at(pid)->get_threads(); + const vector requests = threads.at(tid)->get_requests(); subrequests = requests.at(rid)->get_subrequests(); } catch (domain_error e) @@ -1087,7 +1112,7 @@ TextSimulation::on_show_statistics(const Tokens& arguments) { 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); 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 Tokens args = arguments; - ustring entity = args[0].uppercase(); + const ustring entity = args[0].uppercase(); args.erase(args.begin()); typedef void (TextSimulation::*f_ptr)(const Tokens&); @@ -1183,7 +1208,7 @@ TextSimulation::on_add_thread(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring process = arguments[0]; + const ustring process = arguments[0]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1227,8 +1252,8 @@ TextSimulation::on_add_request(const Tokens& arguments) if (!check_arguments_num(arguments, 2)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1237,10 +1262,10 @@ TextSimulation::on_add_request(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; - vector threads = processes.at(pid)->get_threads(); + const vector threads = processes.at(pid)->get_threads(); t = threads.at(tid); } catch (domain_error e) @@ -1269,9 +1294,9 @@ TextSimulation::on_add_subrequest(const Tokens& arguments) if (!check_arguments_num(arguments, 3)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; - ustring request = arguments[2]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; + const ustring request = arguments[2]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1280,12 +1305,12 @@ TextSimulation::on_add_subrequest(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; - int rid = string_to(request) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; + const int rid = string_to(request) - 1; - vector threads = processes.at(pid)->get_threads(); - vector requests = threads.at(tid)->get_requests(); + const vector threads = processes.at(pid)->get_threads(); + const vector requests = threads.at(tid)->get_requests(); r = requests.at(rid); } @@ -1337,7 +1362,7 @@ TextSimulation::on_remove(const Tokens& arguments) //make a local copy which we'll probably modify Tokens args = arguments; - ustring entity = args[0].uppercase(); + const ustring entity = args[0].uppercase(); args.erase(args.begin()); typedef void (TextSimulation::*f_ptr)(const Tokens&); @@ -1361,7 +1386,7 @@ TextSimulation::on_remove_process(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring process = arguments[0]; + const ustring process = arguments[0]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1393,7 +1418,7 @@ TextSimulation::on_remove_resource(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring resource = arguments[0]; + const ustring resource = arguments[0]; History& h = Simulation::get_instance().get_history(); @@ -1429,8 +1454,8 @@ TextSimulation::on_remove_thread(const Tokens& arguments) if (!check_arguments_num(arguments, 2)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1439,10 +1464,10 @@ TextSimulation::on_remove_thread(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; - vector threads = processes.at(pid)->get_threads(); + const vector threads = processes.at(pid)->get_threads(); t = threads.at(tid); } catch (domain_error e) @@ -1466,9 +1491,9 @@ TextSimulation::on_remove_request(const Tokens& arguments) if (!check_arguments_num(arguments, 3)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; - ustring request = arguments[2]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; + const ustring request = arguments[2]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1477,12 +1502,12 @@ TextSimulation::on_remove_request(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; - int rid = string_to(request) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; + const int rid = string_to(request) - 1; - vector threads = processes.at(pid)->get_threads(); - vector requests = threads.at(tid)->get_requests(); + const vector threads = processes.at(pid)->get_threads(); + const vector requests = threads.at(tid)->get_requests(); r = requests.at(rid); } catch (domain_error e) @@ -1506,10 +1531,10 @@ TextSimulation::on_remove_subrequest(const Tokens& arguments) if (!check_arguments_num(arguments, 4)) return; - ustring process = arguments[0]; - ustring thread = arguments[1]; - ustring request = arguments[2]; - ustring subrequest = arguments[3]; + const ustring process = arguments[0]; + const ustring thread = arguments[1]; + const ustring request = arguments[2]; + const ustring subrequest = arguments[3]; const Environment& env = Simulation::get_instance().get_history().get_environment_at(0); const Environment::Processes& processes = env.get_processes(); @@ -1518,14 +1543,14 @@ TextSimulation::on_remove_subrequest(const Tokens& arguments) try { - int pid = string_to(process) - 1; - int tid = string_to(thread) - 1; - int rid = string_to(request) - 1; - int srid = string_to(subrequest) - 1; + const int pid = string_to(process) - 1; + const int tid = string_to(thread) - 1; + const int rid = string_to(request) - 1; + const int srid = string_to(subrequest) - 1; - vector threads = processes.at(pid)->get_threads(); - vector requests = threads.at(tid)->get_requests(); - vector subrequests = requests.at(rid)->get_subrequests(); + const vector threads = processes.at(pid)->get_threads(); + const vector requests = threads.at(tid)->get_requests(); + const vector subrequests = requests.at(rid)->get_subrequests(); r = subrequests.at(srid); } catch (domain_error e) @@ -1549,11 +1574,11 @@ TextSimulation::on_save(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring filename = arguments[0]; + const ustring filename = arguments[0]; try { - vector serializers = + const vector serializers = SerializersGatekeeper::get_instance().get_registered(); // FIXME using the first serializer available, this @@ -1585,14 +1610,14 @@ TextSimulation::on_load(const Tokens& arguments) if (!check_arguments_num(arguments, 1)) return; - ustring filename = arguments[0]; + const ustring filename = arguments[0]; if (!unsaved_ask_confirm()) return; try { - vector serializers = + const vector serializers = SerializersGatekeeper::get_instance().get_registered(); // FIXME using the first serializer available, this @@ -1750,13 +1775,11 @@ TextSimulation::update(const Simulation& changed_simulation) int printed_instant; static const std::string tab = " "; - // Print header for each instant: printed_instant = static_cast(changed_simulation.get_history().get_front()) - 1; oss << endl << ">>>> " << printed_instant; - // Print ready queue oss << endl << _("READY QUEUE: { "); @@ -1771,23 +1794,20 @@ TextSimulation::update(const Simulation& changed_simulation) oss << _("}") << endl; - // Flush buffer to screen p_stdout(oss.str()); oss.str(string()); - const Environment::Resources& resources = env.get_resources(); const Environment::Processes& processes = env.get_processes(); typedef Environment::Resources::const_iterator ResourceIt; - // Write the queue of requests for each resource oss << _("RESOURCES:") << endl; for (ResourceIt it = resources.begin(); it != resources.end(); ++it) { 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 << r.get_places() << _(" places") << endl; @@ -1817,20 +1837,21 @@ TextSimulation::update(const Simulation& changed_simulation) // Flush buffer to screen p_stdout(oss.str()); oss.str(string()); - // Set new format fillers static const unsigned int fill0 = 25; static const unsigned int fill1 = 15; // 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 << setw(fill0) << _("PROCESSES:"); - oss << right; + oss << right; oss << setw(fill1) << _("state") << setw(fill1) << _("arrival") << setw(fill1) << _("requiring") @@ -1839,8 +1860,12 @@ TextSimulation::update(const Simulation& changed_simulation) << setw(fill1) << _("resource_id") << endl; + // Display information for each schedulable/request in a tabular format + for (unsigned int pi = 0; pi < processes.size(); ++pi) { + // Display process + Process& p = *processes[pi]; oss << setw(2) << right << (pi + 1) << left << ". " << setw(fill0 - 4) << p.get_name().substr(0, fill0 - 5); @@ -1855,7 +1880,9 @@ TextSimulation::update(const Simulation& changed_simulation) p_stdout(oss.str()); oss.str(string()); - vector threads = p.get_threads(); + // Display threads + + const vector threads = p.get_threads(); for (unsigned int ti = 0; ti < threads.size(); ++ti) { @@ -1879,27 +1906,31 @@ TextSimulation::update(const Simulation& changed_simulation) p_stdout(oss.str()); oss.str(string()); - vector requests = t.get_requests(); + // Display requests + + const vector requests = t.get_requests(); for (unsigned int ri = 0; ri < requests.size(); ++ri) { Request& r = *requests[ri]; - vector subrequests = r.get_subrequests(); + // Display subrequests + + const vector subrequests = r.get_subrequests(); for (unsigned int sri = 0; sri < subrequests.size(); ++sri) { SubRequest& sr = *subrequests[sri]; ResourceIt point = resources.find(sr.get_resource_key()); - 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); + 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); oss << right; oss << setw(fill1) << sr.get_state(); - oss << setw(fill1) << r.get_instant(); - oss << setw(fill1) << sr.get_length(); - oss << setw(fill1) << sr.get_length() - sr.get_remaining_time(); - oss << setw(fill1*2) << sr.get_resource_key(); + oss << setw(fill1) << r.get_instant(); + oss << setw(fill1) << sr.get_length(); + oss << setw(fill1) << sr.get_length() - sr.get_remaining_time(); + oss << setw(fill1 * 2) << sr.get_resource_key(); oss << endl; p_stdout(oss.str());