// src/backend/concrete_simulation_statistics.cc - Copyright 2005, 2006, University
//               of Padova, dept. of Pure and Applied
//               Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#include "concrete_simulation_statistics.hh"
#include <sgpemv2/statistics.hh>

#include <iostream>

using namespace std;
using namespace sgpem;

ConcreteSimulationStatistics::~ConcreteSimulationStatistics()
{
}

ConcreteSimulationStatistics::ConcreteSimulationStatistics(const std::vector<ConcreteProcessStatistics> proc_stats, const int& instant)
{
	_average_inactivity_time = 0;
	_average_turn_around = 0;
	_average_response_time = 0;
	_average_efficiency = 0;
	_terminated_processes = 0;
	_terminated_threads = 0;
	_average_throughput = 0;
	
	int schedulables_count = 0;
	
	vector<ConcreteProcessStatistics>::const_iterator p;
	for (p = proc_stats.begin(); p != proc_stats.end(); p++)
	{
		schedulables_count++;
		
		_average_response_time += p->get_response_time();
		/*		
		vector<ThreadStatistics> Tstats = Pstats.get_threads_statistics();
		for (uint t=0; t < Tstats.size(); t++)
		{
			schedulables_count++;	
			_average_response_time += Tstats[t].get_response_time();
		}
		*/
	}
	
	
}
						



float	
ConcreteSimulationStatistics::get_average_inactivity_time() const 
{
	return _average_inactivity_time;
}

float	
ConcreteSimulationStatistics::get_average_turn_around() const 
{
	return _average_turn_around;
}

float	
ConcreteSimulationStatistics::get_average_response_time() const 
{
	return _average_response_time;
}

float	
ConcreteSimulationStatistics::get_average_efficiency() const 
{
	return _average_efficiency;
}

int		
ConcreteSimulationStatistics::get_terminated_processes() const 
{
	return _terminated_processes;
}

int		
ConcreteSimulationStatistics::get_terminated_threads() const 
{
	return _terminated_threads;
}

float	
ConcreteSimulationStatistics::get_average_throughput() const 
{
	return _average_throughput;
}



