- Fixed portability issues. I'm curious to know where that programmer learnt about 'roundf' and 'uint', anyway...

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1153 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-14 17:42:15 +00:00
parent a075567773
commit 6d54f886f1
6 changed files with 20 additions and 19 deletions

View File

@ -46,7 +46,7 @@ ConcreteProcessStatistics::ConcreteProcessStatistics(const Process* core, const
{
//retrieve threads statistics necessary to calculate "core"'s statistics
vector<const Thread*> threads = core->get_threads();
for (uint i_t = 0; i_t < threads.size(); i_t++)
for (unsigned int i_t = 0; i_t < threads.size(); i_t++)
_threads_stats.push_back(ConcreteThreadStatistics(threads[i_t], instant));
@ -102,7 +102,7 @@ ConcreteProcessStatistics::ConcreteProcessStatistics(const Process* core, const
const Environment& env = hist.get_environment_at(time);
const vector<Process*> procs = env.get_processes();
for (uint i_p=0; i_p < procs.size(); i_p++)
for (unsigned int i_p=0; i_p < procs.size(); i_p++)
if (*procs[i_p] == *core && procs[i_p]->get_state() == Schedulable::state_blocked)
_resource_waitings_time++;
}
@ -201,7 +201,7 @@ vector<const ThreadStatistics*>
ConcreteProcessStatistics::get_threads_statistics() const
{
vector<const ThreadStatistics*> rit;
for (uint i=0; i < _threads_stats.size(); i++)
for (unsigned int i=0; i < _threads_stats.size(); i++)
rit.push_back(&_threads_stats[i]);
return rit;
}

View File

@ -56,13 +56,13 @@ ConcreteSimulationStatistics::ConcreteSimulationStatistics(const std::vector<Con
//iterate through all processes
vector<Process*> procs = Simulation::get_instance().get_history().get_environment_at(instant).get_processes();
for (uint i=0; i < procs.size(); i++)
for (unsigned int i=0; i < procs.size(); i++)
{
if (procs[i]->get_state() == Schedulable::state_terminated)
_terminated_processes++;
vector<Thread*> threads = procs[i]->get_threads();
//iterate through all threads of this process
for (uint ii=0; ii < threads.size(); ii++)
for (unsigned int ii=0; ii < threads.size(); ii++)
if (threads[ii]->get_state() == Schedulable::state_terminated)
_terminated_threads++;
}
@ -100,19 +100,19 @@ ConcreteSimulationStatistics::ConcreteSimulationStatistics(const std::vector<Con
}
//make the AVARAGE and ROUND the values
//make the AVERAGE and ROUND the values
if (started_schedulables_count != 0)
{
_average_response_time = roundf((_average_response_time/started_schedulables_count)*100)/100.0;
_average_efficiency = roundf((_average_efficiency/started_schedulables_count)*100)/100.0;
_average_inactivity_time = roundf((_average_inactivity_time/started_schedulables_count)*100)/100.0;
_average_turn_around = roundf((_average_turn_around/started_schedulables_count)*100)/100.0;
_average_execution_progress = roundf((_average_execution_progress/started_schedulables_count)*100)/100.0;
modf(((_average_response_time / started_schedulables_count) * 100.0f) / 100.0f, &_average_response_time);
modf(((_average_efficiency / started_schedulables_count) * 100.0f) / 100.0f, &_average_efficiency);
modf(((_average_inactivity_time / started_schedulables_count) * 100.0f) / 100.0f, &_average_inactivity_time);
modf(((_average_turn_around / started_schedulables_count) * 100.0f) / 100.0f, &_average_turn_around);
modf(((_average_execution_progress / started_schedulables_count) * 100.0f) / 100.0f, &_average_execution_progress);
}
if (instant != 0)
{
_average_processes_throughput = roundf(((float)_terminated_processes/(float)instant)*1000)/1000.0;
_average_threads_throughput = roundf(((float)_terminated_threads /(float)instant)*1000)/1000.0;
modf((((float)_terminated_processes / (float)instant) * 1000.0f) / 1000.0f, &_average_processes_throughput);
modf((((float)_terminated_threads / (float)instant) * 1000.0f) / 1000.0f, &_average_threads_throughput);
}
}

View File

@ -48,7 +48,7 @@ ConcreteStatistics::calculateStatisticsAt(const int& instant)
//create all process statistics (which themselves create their thread statistics)
_proc_stats.clear();
for (uint p = 0; p < procs.size(); p++)
for (unsigned int p = 0; p < procs.size(); p++)
_proc_stats.push_back(ConcreteProcessStatistics(procs[p], instant));
if (_sim_stats)
@ -71,7 +71,7 @@ std::vector<const ProcessStatistics*>
ConcreteStatistics::get_process_statistics() const
{
vector<const ProcessStatistics*> rit;
for (uint i=0; i < _proc_stats.size(); i++)
for (unsigned int i=0; i < _proc_stats.size(); i++)
rit.push_back(&_proc_stats[i]);
return rit;
}

View File

@ -60,11 +60,11 @@ ConcreteThreadStatistics::ConcreteThreadStatistics(const Thread* core, const int
const vector<Process*> procs = env.get_processes();
//looks for the process that owns this thread
for (uint i_p=0; i_p < procs.size(); i_p++)
for (unsigned int i_p=0; i_p < procs.size(); i_p++)
{
const vector<Thread*> threads = procs[i_p]->get_threads();
//looks for the thread "core"
for (uint i_t = 0; i_t < threads.size(); i_t++)
for (unsigned int i_t = 0; i_t < threads.size(); i_t++)
{
if ( (*threads[i_t]) == (*core) ) //FOUND!!
{
@ -110,7 +110,7 @@ ConcreteThreadStatistics::ConcreteThreadStatistics(const Thread* core, const int
{
Environment::resource_key_t key = (*res_iter).first;
vector<SubRequest*> req = env.get_request_queue(key);
for (uint i_r=0; i_r < req.size(); i_r++)
for (unsigned int i_r=0; i_r < req.size(); i_r++)
if( (*req[i_r]).get_request().get_thread() == (*core) && (*req[i_r]).get_state() == Request::state_allocated)
_resource_usage_time++;

View File

@ -31,6 +31,7 @@
#include <glibmm/pattern.h>
#include <iostream>
#include <algorithm>
using namespace sgpem;
using namespace std;

View File

@ -126,7 +126,7 @@ namespace sgpem
waiting the time defined with set_timer() between each step, until all
processes have terminated, or some error happens.
*/
virtual void set_mode(const mode) = 0;
virtual void set_mode(mode) = 0;
/**
\return The simulation advancement mode: 0 if step-to-step, 1 if