- Adeed simple tabular statistics, modified statistics interfaces,
updated architecture (don't know if something is missing...) git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1092 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
afd292142e
commit
96dbda64cd
28 changed files with 1475 additions and 463 deletions
|
@ -19,55 +19,61 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "concrete_statistics.hh"
|
||||
#include "sgpemv2/simulation.hh"
|
||||
#include "sgpemv2/history.hh"
|
||||
#include "sgpemv2/environment.hh"
|
||||
#include "sgpemv2/schedulable.hh"
|
||||
#include "sgpemv2/process.hh"
|
||||
#include "sgpemv2/thread.hh"
|
||||
#include "thread_statistics.hh"
|
||||
#include "process_statistics.hh"
|
||||
#include <sgpemv2/simulation.hh>
|
||||
#include <sgpemv2/history.hh>
|
||||
#include <sgpemv2/environment.hh>
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
#include <sgpemv2/process.hh>
|
||||
#include <sgpemv2/thread.hh>
|
||||
#include "concrete_thread_statistics.hh"
|
||||
#include "concrete_process_statistics.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace sgpem;
|
||||
using namespace std;
|
||||
|
||||
ConcreteStatistics::ConcreteStatistics()
|
||||
{}
|
||||
|
||||
|
||||
vector<ProcessStatistics>
|
||||
ConcreteStatistics::get_process_statistics(const int& instant) const
|
||||
|
||||
|
||||
ConcreteStatistics::ConcreteStatistics(): _sim_stats(0)
|
||||
{
|
||||
//vector<ThreadStatistics*> thread_stats;
|
||||
vector<ProcessStatistics> rit;
|
||||
calculateStatisticsAt(-1);
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteStatistics::calculateStatisticsAt(const int& instant)
|
||||
{
|
||||
//retrieve all processes
|
||||
vector<Process*> procs = Simulation::get_instance().get_history().get_environment_at(0).get_processes();
|
||||
|
||||
const History& hist = Simulation::get_instance().get_history();
|
||||
const Environment& env = hist.get_environment_at(instant);
|
||||
const vector<Process*> procs = env.get_processes();
|
||||
//create all process statistics (which themselves create their thread statistics)
|
||||
_proc_stats.clear();
|
||||
for (uint p = 0; p < procs.size(); p++)
|
||||
_proc_stats.push_back(ConcreteProcessStatistics(procs[p], instant));
|
||||
|
||||
//first calculate all THREADS statistics
|
||||
for (uint i_p=0; i_p < procs.size(); i_p++)
|
||||
{
|
||||
/*const vector<Thread*> threads = procs[i_p]->get_threads();
|
||||
for (uint i_t = 0; i_t < threads.size(); i_t++)
|
||||
{
|
||||
ThreadStatistics* s = new ThreadStatistics(threads[i_t], instant);
|
||||
thread_stats.push_back(s);
|
||||
rit.push_back(s);
|
||||
}
|
||||
*/
|
||||
rit.push_back(ProcessStatistics(procs[i_p], instant));
|
||||
}
|
||||
/*
|
||||
//then calculate PROCESSES statistics USING the previous ones
|
||||
for (uint i_p=0; i_p < procs.size(); i_p++)
|
||||
{
|
||||
SchedulableStatistics* s = new ProcessStatistics(procs[i_p], instant, &thread_stats);
|
||||
rit.push_back(s);
|
||||
}
|
||||
*/
|
||||
if (_sim_stats)
|
||||
delete _sim_stats;
|
||||
//create simulation statistics using just obtained process statistics
|
||||
_sim_stats = new ConcreteSimulationStatistics(_proc_stats, instant);
|
||||
}
|
||||
|
||||
const SimulationStatistics*
|
||||
ConcreteStatistics::get_simulation_statistics() const
|
||||
{
|
||||
return _sim_stats;
|
||||
}
|
||||
|
||||
/**
|
||||
\warning Don't delete these pointers!!
|
||||
\warning These pointers are not valid anymore AFTER a call to calculateStatisticsAt
|
||||
*/
|
||||
std::vector<const ProcessStatistics*>
|
||||
ConcreteStatistics::get_process_statistics() const
|
||||
{
|
||||
vector<const ProcessStatistics*> rit;
|
||||
for (uint i=0; i < _proc_stats.size(); i++)
|
||||
rit.push_back(&_proc_stats[i]);
|
||||
return rit;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue