- added few frontend classes

- updated others from backend

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@330 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
fpaparel 2006-02-15 22:58:18 +00:00
parent 34648139ec
commit 6d5e9270a8
16 changed files with 467 additions and 42 deletions

View file

@ -56,7 +56,7 @@ History::get_scheduled_at(int time) const
//look for a runing entity
smart_ptr<const SchedulableList> p = get_simulation_status_at(time);
for (int i = 0; i < p->size(); i++)
for (uint i = 0; i < p->size(); i++)
if (p->get_item_at(i)->get_state() == SchedulableStatus::state_running)
return smart_ptr<const SchedulableStatus>(new SchedulableStatus(*(p->get_item_at(i))));
@ -138,8 +138,9 @@ History::truncate_at(int instant)
//replaces the current vector with the "trimmed" one.
_slices = vector<Slice>(_slices.begin(),i);
_total_time_elapsed = instant;
return;
break;
}
notify();
}

View file

@ -49,6 +49,7 @@ namespace sgpem
virtual bool is_pre_emptive() const = 0;
virtual int get_time_slice() const = 0;
virtual void set_time_slice(const int&) = 0;
const PolicyParameters& get_parameters() const;

View file

@ -24,17 +24,4 @@ using namespace std;
PythonPolicy::PythonPolicy()
{
// The following line is ugly, but necessary if we use
// non-standard installation directories. Theoretically,
// it should be up to the user to set correct
// environment variables.
// FIXME: find better way to achieve this.
//PyRun_SimpleString("import sys\n"
// "sys.path[:0] = [ '" MODDIR "', '" PYCDIR "' ]\n"
//"print '[II] Module search path is :', sys.path\n");
const char* filename = PYCDIR "/loadme.py";
cout << filename;
cout.flush();
}

View file

@ -47,6 +47,20 @@ void
PythonPolicyManager::init()
{
Py_Initialize();
// The following line is ugly, but necessary if we use
// non-standard installation directories. Theoretically,
// it should be up to the user to set correct
// environment variables.
// FIXME: find better way to achieve this.
PyRun_SimpleString("import sys\n"
"sys.path[:0] = [ '" MODDIR "', '" PYCDIR "' ]\n"
"print '[II] Module search path is :', sys.path\n");
const char* filename = PYCDIR "/loadme.py";
std::cout << "\n\n" << filename;
std::cout.flush();
}

View file

@ -45,6 +45,7 @@ Scheduler::get_ready_queue()
return &_ready_queue;
}
/** \note E' fondamentale che questo metodo memorizzi localmente qualora la politica
attuale sia a prerilascio o meno, e la durata del quanto di tempo, in quanto la politica
e' libera di variare questi parametri a piacere durante l'esecuzione della simulazione
@ -57,6 +58,19 @@ Scheduler::reset_status()
// restore the policy
}
void
Scheduler::set_policy(Policy* p)
{
_policy = p;
}
Policy*
Scheduler::get_policy()
{
return _policy;
}
void
Scheduler::step_forward()
@ -146,6 +160,3 @@ Scheduler::step_forward()

View file

@ -56,7 +56,10 @@ namespace sgpem
SchedulableList* get_ready_queue();
void reset_status();
void step_forward();
void set_policy(Policy*);
Policy* get_policy();
private:
Scheduler(int); //private constructor. The parameter is discarded
static Scheduler _instance;