- Added support for whole-simulation statistics to textual simulation
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1128 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
5f0f9fed29
commit
d15643131f
|
@ -1062,6 +1062,8 @@ Syntax depends from entities being displayed:
|
||||||
With <thread_id> being the numeric identifier of the thread child of process identified by <process_id>
|
With <thread_id> being the numeric identifier of the thread child of process identified by <process_id>
|
||||||
@item @command{show subrequests <process_id> <thread_id> <request_id>}
|
@item @command{show subrequests <process_id> <thread_id> <request_id>}
|
||||||
Where the numeric ids follow the same logic of the previous commands
|
Where the numeric ids follow the same logic of the previous commands
|
||||||
|
@item @command{show statistics}
|
||||||
|
Shows statistics for the whole simulation for the current instant
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@item @command{add}
|
@item @command{add}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <sgpemv2/request.hh>
|
#include <sgpemv2/request.hh>
|
||||||
#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/templates/sequences.tcc>
|
#include <sgpemv2/templates/sequences.tcc>
|
||||||
|
|
||||||
|
@ -677,7 +678,8 @@ TextSimulation::on_help(const Tokens& arguments)
|
||||||
"`SHOW requests <process_id> <thread_id>` with <thread_id> being the numeric "
|
"`SHOW requests <process_id> <thread_id>` with <thread_id> being the numeric "
|
||||||
"identifier of the thread child of process identified by <process_id>\n"
|
"identifier of the thread child of process identified by <process_id>\n"
|
||||||
"`SHOW subrequests <process_id> <thread_id> <request_id>` where the numeric ids "
|
"`SHOW subrequests <process_id> <thread_id> <request_id>` where the numeric ids "
|
||||||
"follow the same logic of the previous commands\n"));
|
"follow the same logic of the previous commands\n"
|
||||||
|
"`SHOW statistics`\n"));
|
||||||
else if (command == "ADD")
|
else if (command == "ADD")
|
||||||
p_stderr(_("-- ADD COMMAND --\nAdds an entity by using a questionary-like approach.\n\n"
|
p_stderr(_("-- ADD COMMAND --\nAdds an entity by using a questionary-like approach.\n\n"
|
||||||
"Syntax depends from entity being added:\n"
|
"Syntax depends from entity being added:\n"
|
||||||
|
@ -904,6 +906,7 @@ TextSimulation::on_show(const Tokens& arguments)
|
||||||
entities_handlers["SUBREQUESTS"] = &TextSimulation::on_show_subrequests;
|
entities_handlers["SUBREQUESTS"] = &TextSimulation::on_show_subrequests;
|
||||||
entities_handlers["CPU-POLICIES"] = &TextSimulation::on_show_cpu_policies;
|
entities_handlers["CPU-POLICIES"] = &TextSimulation::on_show_cpu_policies;
|
||||||
entities_handlers["RESOURCE-POLICIES"] = &TextSimulation::on_show_resource_policies;
|
entities_handlers["RESOURCE-POLICIES"] = &TextSimulation::on_show_resource_policies;
|
||||||
|
entities_handlers["STATISTICS"] = &TextSimulation::on_show_statistics;
|
||||||
|
|
||||||
if (entities_handlers.find(entities) == entities_handlers.end())
|
if (entities_handlers.find(entities) == entities_handlers.end())
|
||||||
p_stderr(_("ERROR: invalid argument\n"));
|
p_stderr(_("ERROR: invalid argument\n"));
|
||||||
|
@ -1079,6 +1082,30 @@ TextSimulation::on_show_resource_policies(const Tokens& arguments)
|
||||||
show_policies<ResourcePoliciesGatekeeper>(arguments);
|
show_policies<ResourcePoliciesGatekeeper>(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TextSimulation::on_show_statistics(const Tokens& arguments)
|
||||||
|
{
|
||||||
|
check_arguments_num(arguments, 0);
|
||||||
|
|
||||||
|
unsigned int front = Simulation::get_instance().get_history().get_front();
|
||||||
|
Statistics::get_instance().calculateStatisticsAt(front);
|
||||||
|
const SimulationStatistics* sim = Statistics::get_instance().get_simulation_statistics();
|
||||||
|
|
||||||
|
ostringstream oss;
|
||||||
|
|
||||||
|
oss << "\n\n****** SIMULATION STATISTICS *******\n AVG_RESP= "
|
||||||
|
<< sim->get_average_response_time() << " AVG_INACT= " << sim->get_average_inactivity_time() <<
|
||||||
|
" AVG_EXEC= " << sim->get_average_execution_progress() <<
|
||||||
|
"% AVG_EFFIC= " << sim->get_average_efficiency() <<
|
||||||
|
"% AVG_TURN= " << sim->get_average_turn_around() <<
|
||||||
|
" TERM_PROCS= " << sim->get_terminated_processes() <<
|
||||||
|
" TERM_THRES= " << sim->get_terminated_threads() <<
|
||||||
|
" THRU_PROCS= " << sim->get_average_processes_throughput() <<
|
||||||
|
" THRU_THREA= " << sim->get_average_threads_throughput() << "\n\n";
|
||||||
|
|
||||||
|
p_stdout(oss.str());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TextSimulation::on_add(const Tokens& arguments)
|
TextSimulation::on_add(const Tokens& arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,7 @@ namespace sgpem
|
||||||
void on_show_subrequests(const Tokens& arguments);
|
void on_show_subrequests(const Tokens& arguments);
|
||||||
void on_show_cpu_policies(const Tokens& arguments);
|
void on_show_cpu_policies(const Tokens& arguments);
|
||||||
void on_show_resource_policies(const Tokens& arguments);
|
void on_show_resource_policies(const Tokens& arguments);
|
||||||
|
void on_show_statistics(const Tokens& arguments);
|
||||||
void on_add(const Tokens& arguments);
|
void on_add(const Tokens& arguments);
|
||||||
void on_add_process(const Tokens& arguments);
|
void on_add_process(const Tokens& arguments);
|
||||||
void on_add_resource(const Tokens& arguments);
|
void on_add_resource(const Tokens& arguments);
|
||||||
|
@ -112,8 +113,6 @@ namespace sgpem
|
||||||
void on_save(const Tokens& arguments);
|
void on_save(const Tokens& arguments);
|
||||||
void on_load(const Tokens& arguments);
|
void on_load(const Tokens& arguments);
|
||||||
|
|
||||||
// FIXME This is a temporary replacement for the
|
|
||||||
// to-be written I/O layer
|
|
||||||
static void p_stdout(const Glib::ustring& str);
|
static void p_stdout(const Glib::ustring& str);
|
||||||
static void p_stderr(const Glib::ustring& str);
|
static void p_stderr(const Glib::ustring& str);
|
||||||
static Glib::ustring readline();
|
static Glib::ustring readline();
|
||||||
|
|
Loading…
Reference in New Issue