- Rename Policy to CPUPolicy where appropriate
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@811 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
5b577c5979
commit
43b817aaed
31 changed files with 222 additions and 225 deletions
|
@ -1,7 +1,7 @@
|
|||
from Policy import Policy
|
||||
from CPUPolicy import CPUPolicy
|
||||
import sys
|
||||
|
||||
class python_loader_configure(Policy) :
|
||||
class python_loader_configure(CPUPolicy) :
|
||||
def __init__(self):
|
||||
pass;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from Policy import Policy
|
||||
from CPUPolicy import CPUPolicy
|
||||
import sys
|
||||
|
||||
class python_loader_get_time_slice(Policy) :
|
||||
class python_loader_get_time_slice(CPUPolicy) :
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from Policy import Policy
|
||||
from CPUPolicy import CPUPolicy
|
||||
import sys
|
||||
|
||||
class python_loader_is_preemptive(Policy) :
|
||||
class python_loader_is_preemptive(CPUPolicy) :
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from Policy import Policy
|
||||
from CPUPolicy import CPUPolicy
|
||||
import sys
|
||||
|
||||
class python_loader_sort_queue(Policy) :
|
||||
class python_loader_sort_queue(CPUPolicy) :
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
* class and its closely related cousins. More documentation to be written
|
||||
* here, thanks very much. */
|
||||
|
||||
#include "../python_policy_manager.hh"
|
||||
#include "../python_policy.hh"
|
||||
#include "../cpu_python_policy_manager.hh"
|
||||
#include "../cpu_python_policy.hh"
|
||||
|
||||
#include "simulation.hh"
|
||||
#include "global_preferences.hh"
|
||||
#include "policies_gatekeeper.hh"
|
||||
#include "cpu_policies_gatekeeper.hh"
|
||||
#include "simulation.hh"
|
||||
#include "scheduler.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
|
@ -42,10 +42,10 @@
|
|||
using namespace sgpem;
|
||||
using namespace std;
|
||||
|
||||
static Policy*
|
||||
find_pol_by_name(const vector<Policy*>& pols, const Glib::ustring& name)
|
||||
static CPUPolicy*
|
||||
find_pol_by_name(const vector<CPUPolicy*>& pols, const Glib::ustring& name)
|
||||
{
|
||||
vector<Policy*>::const_iterator it = pols.begin();
|
||||
vector<CPUPolicy*>::const_iterator it = pols.begin();
|
||||
for( ; it != pols.end(); it++)
|
||||
if((*it)->get_name() == name)
|
||||
return *it;
|
||||
|
@ -69,24 +69,24 @@ main(int argc, char** argv)
|
|||
sgpem::GlobalPreferences::get_instance().add_policies_dir(argv[1]);
|
||||
|
||||
// Self-register itself to PoliciesGatekeeper, however we don't care about it
|
||||
PythonPolicyManager polman;
|
||||
PythonCPUPolicyManager polman;
|
||||
polman.init();
|
||||
|
||||
Simulation& sim = Simulation::get_instance();
|
||||
History& his = sim.get_history();
|
||||
PoliciesGatekeeper& pgk = PoliciesGatekeeper::get_instance();
|
||||
CPUPoliciesGatekeeper& pgk = CPUPoliciesGatekeeper::get_instance();
|
||||
|
||||
const std::vector<Policy*>& policies = polman.get_avail_policies();
|
||||
const std::vector<CPUPolicy*>& policies = polman.get_avail_policies();
|
||||
|
||||
// Print out avail policies
|
||||
cout << "These are the policies I found:" << endl;
|
||||
vector<Policy*>::const_iterator it = policies.begin();
|
||||
vector<CPUPolicy*>::const_iterator it = policies.begin();
|
||||
for(; it != policies.end(); it++)
|
||||
cout << "\t * " << (*it)->get_name() << endl;
|
||||
|
||||
try
|
||||
{
|
||||
Policy* pol = find_pol_by_name(policies, "python_loader_configure");
|
||||
CPUPolicy* pol = find_pol_by_name(policies, "python_loader_configure");
|
||||
assert(pol != NULL);
|
||||
|
||||
// FIXME : Maybe activating a policy only to configure it is an overkill?
|
||||
|
@ -103,7 +103,7 @@ main(int argc, char** argv)
|
|||
|
||||
try
|
||||
{
|
||||
Policy* pol = find_pol_by_name(policies, "python_loader_is_preemptive");
|
||||
CPUPolicy* pol = find_pol_by_name(policies, "python_loader_is_preemptive");
|
||||
assert(pol != NULL);
|
||||
pgk.activate_policy(&his, pol);
|
||||
pol->is_pre_emptive();
|
||||
|
@ -117,7 +117,7 @@ main(int argc, char** argv)
|
|||
|
||||
try
|
||||
{
|
||||
Policy* pol = find_pol_by_name(policies, "python_loader_get_time_slice");
|
||||
CPUPolicy* pol = find_pol_by_name(policies, "python_loader_get_time_slice");
|
||||
assert(pol != NULL);
|
||||
pgk.activate_policy(&his, pol);
|
||||
pol->get_time_slice();
|
||||
|
@ -132,7 +132,7 @@ main(int argc, char** argv)
|
|||
|
||||
try
|
||||
{
|
||||
Policy* pol = find_pol_by_name(policies, "python_loader_get_time_slice");
|
||||
CPUPolicy* pol = find_pol_by_name(policies, "python_loader_get_time_slice");
|
||||
assert(pol != NULL);
|
||||
pgk.activate_policy(&his, pol);
|
||||
pol->sort_queue();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue