- Small fix to let the application work
using ResourcePoliciesGatekeeper git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@968 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
685a6d84f0
commit
26755fd876
|
@ -25,11 +25,17 @@
|
||||||
|
|
||||||
using namespace sgpem;
|
using namespace sgpem;
|
||||||
|
|
||||||
|
// instantiate a default instance of this class.
|
||||||
|
DefaultResourcePolicyManager DefaultResourcePolicyManager::_default_instance;
|
||||||
|
|
||||||
|
|
||||||
DefaultResourcePolicyManager::DefaultResourcePolicyManager()
|
DefaultResourcePolicyManager::DefaultResourcePolicyManager()
|
||||||
{
|
{
|
||||||
ResourcePolicy * lifo = new ResourcePolicyLiFo();
|
ResourcePolicy * lifo = new ResourcePolicyLiFo();
|
||||||
_policies.push_back(lifo);
|
_policies.push_back(lifo);
|
||||||
ResourcePoliciesGatekeeper::get_instance().register_manager(this);
|
ResourcePoliciesGatekeeper::get_instance().register_manager(this);
|
||||||
|
// Includes default policies.
|
||||||
|
_policies.push_back(new ResourcePolicyLiFo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,10 @@ namespace sgpem
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<ResourcePolicy*> _policies;
|
std::vector<ResourcePolicy*> _policies;
|
||||||
|
|
||||||
|
// an Instance of this class is created by default and it is registered to
|
||||||
|
// the ResourcePolicyGateKeeper
|
||||||
|
static DefaultResourcePolicyManager _default_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //~ namespace sgpem
|
} //~ namespace sgpem
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
#include "backend/cpu_policies_gatekeeper.hh"
|
#include "backend/cpu_policies_gatekeeper.hh"
|
||||||
#include "backend/cpu_policy.hh"
|
#include "backend/cpu_policy.hh"
|
||||||
#include "backend/cpu_policy_manager.hh"
|
#include "backend/cpu_policy_manager.hh"
|
||||||
|
#include "backend/resource_policies_gatekeeper.hh"
|
||||||
|
#include "backend/resource_policy_manager.hh"
|
||||||
|
|
||||||
|
|
||||||
#include "backend/history.hh"
|
#include "backend/history.hh"
|
||||||
#include "backend/simulation.hh"
|
#include "backend/simulation.hh"
|
||||||
|
@ -273,6 +276,14 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
|
||||||
CPUPolicy* policy = pgk.get_registered()[0]->get_avail_policies()[1]; // RoundRobin at the moment of writing
|
CPUPolicy* policy = pgk.get_registered()[0]->get_avail_policies()[1]; // RoundRobin at the moment of writing
|
||||||
std::cout << "Selected policy : " << policy->get_name() << std::endl;
|
std::cout << "Selected policy : " << policy->get_name() << std::endl;
|
||||||
sim.set_policy(policy);
|
sim.set_policy(policy);
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: dedicate a function to set resource policy
|
||||||
|
// which includes the following default one
|
||||||
|
ResourcePolicyManager & rpm = *ResourcePoliciesGatekeeper::get_instance().get_registered().at(0);
|
||||||
|
Simulation::get_instance().set_resource_policy(rpm.get_avail_policies().at(0));
|
||||||
|
// end of include
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include "backend/serializer.hh"
|
#include "backend/serializer.hh"
|
||||||
#include "backend/process.hh"
|
#include "backend/process.hh"
|
||||||
#include "backend/resource.hh"
|
#include "backend/resource.hh"
|
||||||
// FIXME: remove the following and use the gatekeeper
|
#include "backend/resource_policies_gatekeeper.hh"
|
||||||
#include "backend/resource_policy_lifo.hh"
|
#include "backend/resource_policy_manager.hh"
|
||||||
#include "backend/thread.hh"
|
#include "backend/thread.hh"
|
||||||
#include "backend/request.hh"
|
#include "backend/request.hh"
|
||||||
#include "backend/sub_request.hh"
|
#include "backend/sub_request.hh"
|
||||||
|
@ -778,7 +778,10 @@ TextSimulation::on_set(const Tokens& arguments)
|
||||||
{
|
{
|
||||||
Simulation::get_instance().set_policy(*it);
|
Simulation::get_instance().set_policy(*it);
|
||||||
// FIXME: dedicate a function to set resource policy
|
// FIXME: dedicate a function to set resource policy
|
||||||
Simulation::get_instance().set_resource_policy(new ResourcePolicyLiFo()); // leak leak leak
|
// which includes the following default one
|
||||||
|
ResourcePolicyManager & rpm = *ResourcePoliciesGatekeeper::get_instance().get_registered().at(0);
|
||||||
|
Simulation::get_instance().set_resource_policy(rpm.get_avail_policies().at(0));
|
||||||
|
// end of include
|
||||||
}
|
}
|
||||||
|
|
||||||
--policy;
|
--policy;
|
||||||
|
|
Loading…
Reference in New Issue