sgpemv2/src/backend/scheduler.cc
tchernobog 94f7c1d127 - Fix compilation of libbackend.so
- Erased Scheduler::step_forward(): reimplementing from
scratch


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@701 3ecf2c5c-341e-0410-92b4-d18e462d057c
2006-07-03 20:55:19 +00:00

93 lines
2.5 KiB
C++

// src/backend/scheduler.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "policy.hh"
#include "scheduler.hh"
#include "policy_manager.hh"
#include "policies_gatekeeper.hh"
#include "user_interrupt_exception.hh"
// Do not include full template definition in the header file
#include "singleton.tcc"
#include <iostream>
using namespace std;
using namespace sgpem;
// Explicit template instantiation to allow to export symbols from the DSO.
template class SG_DLLEXPORT Singleton<Scheduler>;
//private constructor. The parameter is discarded
Scheduler::Scheduler()
: _policy_manager(PolicyManager::get_registered_manager())
{
_policy_manager.init();
}
ReadyQueue*
Scheduler::get_ready_queue()
{
// FIXME return the correct queue accordingly to the value returned by Policy::wants()
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
*/
void
Scheduler::reset_status()
{
// DEPRECATED (?)
}
Policy&
Scheduler::get_policy()
{
// FIXME : fixme.
// return *PoliciesGatekeeper::get_instance().get_current_policy(&History::get_instance());
}
void
Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterruptException)
{
try
{
}
catch( UserInterruptException e )
{
_policy_manager.init();
//TODO Do we need to perform some cleanup operation here?
// Do we need to update something?
// Going up unwinding the stack, tell:
// - the user that the policy sucks
// - SimulationController that everything stopped
throw;
}
}