- Fix CPUPolicy.get_parameters() in Python with a simple yet effective hack
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@835 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
86308ca185
commit
3968bc7cbd
|
@ -97,7 +97,7 @@ class CPUPolicy:
|
||||||
#
|
#
|
||||||
# @return A sgpem::PolicyParameters instance
|
# @return A sgpem::PolicyParameters instance
|
||||||
def get_parameters(self):
|
def get_parameters(self):
|
||||||
return sgpem.Scheduler.get_instance().get_policy().get_parameters()
|
return sgpem.CPUPolicy.get_active_policy().get_parameters()
|
||||||
|
|
||||||
|
|
||||||
## @brief This function implements an in-place stable sort
|
## @brief This function implements an in-place stable sort
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
%module sgpem
|
%module sgpem
|
||||||
%{
|
%{
|
||||||
#include "cpu_policy.hh"
|
#include "cpu_policy.hh"
|
||||||
|
#include "cpu_policies_gatekeeper.hh"
|
||||||
|
#include "history.hh"
|
||||||
#include "policy_parameters.hh"
|
#include "policy_parameters.hh"
|
||||||
#include "process.hh"
|
#include "process.hh"
|
||||||
#include "ready_queue.hh"
|
#include "ready_queue.hh"
|
||||||
#include "schedulable.hh"
|
#include "schedulable.hh"
|
||||||
#include "scheduler.hh"
|
#include "scheduler.hh"
|
||||||
|
#include "simulation.hh"
|
||||||
#include "thread.hh"
|
#include "thread.hh"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -63,6 +66,15 @@ namespace sgpem {
|
||||||
public:
|
public:
|
||||||
virtual ~CPUPolicy() = 0;
|
virtual ~CPUPolicy() = 0;
|
||||||
sgpem::PolicyParameters& get_parameters();
|
sgpem::PolicyParameters& get_parameters();
|
||||||
|
|
||||||
|
%extend {
|
||||||
|
// Convenience function to get the current policy
|
||||||
|
static CPUPolicy* get_active_policy()
|
||||||
|
{
|
||||||
|
History& h = Simulation::get_instance().get_history();
|
||||||
|
return CPUPoliciesGatekeeper::get_instance().get_current_policy(&h);
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
|
@ -218,9 +230,9 @@ namespace sgpem {
|
||||||
}; //~ class ReadyQueue
|
}; //~ class ReadyQueue
|
||||||
|
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
|
|
||||||
class Scheduler {
|
class Scheduler {
|
||||||
public:
|
public:
|
||||||
sgpem::CPUPolicy* get_policy();
|
|
||||||
static sgpem::Scheduler& get_instance();
|
static sgpem::Scheduler& get_instance();
|
||||||
sgpem::ReadyQueue* get_ready_queue();
|
sgpem::ReadyQueue* get_ready_queue();
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue