- Added a bit of resource policy mamagement. Still far from being usefu.
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@958 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
980d9b410a
commit
f3dc9b77df
7 changed files with 65 additions and 16 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "simulation_observer.hh"
|
||||
#include "scheduler.hh"
|
||||
#include "cpu_policies_gatekeeper.hh"
|
||||
#include "resource_policies_gatekeeper.hh"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
@ -38,8 +39,9 @@ using namespace memory;
|
|||
|
||||
ConcreteSimulation::ConcreteSimulation() :
|
||||
Simulation(), _state(state_stopped),
|
||||
_mode(mode_continuous), _policy(NULL)
|
||||
{}
|
||||
_mode(mode_continuous), _policy(NULL), _resource_policy(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteSimulation::set_mode(const mode new_mode)
|
||||
|
@ -158,7 +160,13 @@ ConcreteSimulation::step()
|
|||
if (get_policy() == NULL)
|
||||
{
|
||||
stop();
|
||||
throw NullPolicyException("no policy selected");
|
||||
throw NullPolicyException("no CPU policy selected");
|
||||
}
|
||||
|
||||
if (get_resource_policy() == NULL)
|
||||
{
|
||||
stop();
|
||||
throw NullPolicyException("no resource policy selected");
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -166,7 +174,7 @@ ConcreteSimulation::step()
|
|||
//step forward
|
||||
bool yet_to_finish = true;
|
||||
if (_front == get_history().get_size() - 1)
|
||||
yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy());
|
||||
yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy());
|
||||
_front++;
|
||||
return yet_to_finish;
|
||||
}
|
||||
|
@ -239,3 +247,18 @@ ConcreteSimulation::get_policy()
|
|||
{
|
||||
return _policy;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteSimulation::set_resource_policy(ResourcePolicy* p)
|
||||
{
|
||||
ResourcePoliciesGatekeeper::get_instance().activate_policy(&_history, p);
|
||||
_resource_policy = p;
|
||||
}
|
||||
|
||||
|
||||
ResourcePolicy*
|
||||
ConcreteSimulation::get_resource_policy()
|
||||
{
|
||||
return _resource_policy;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue