- Merge branch 0.3-r1003--scheduler-manage-preemption into trunk
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1023 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
cb5d958790
commit
df4b1b4205
11 changed files with 158 additions and 55 deletions
|
@ -64,7 +64,7 @@ ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, N
|
|||
// pauses the simulation (see below)
|
||||
break;
|
||||
case state_stopped:
|
||||
_history.step_front(0);
|
||||
_history.set_front(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -86,7 +86,7 @@ ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, N
|
|||
yet_to_finish = step();
|
||||
increment++;
|
||||
}
|
||||
get_history().step_front(p);
|
||||
get_history().set_front(std::min(p, _history.get_size()));
|
||||
if (!yet_to_finish)
|
||||
stop();
|
||||
|
||||
|
@ -126,7 +126,7 @@ ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException, Mal
|
|||
switch (_state)
|
||||
{
|
||||
case state_stopped:
|
||||
_history.step_front(0);
|
||||
_history.set_front(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -136,9 +136,10 @@ ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException, Mal
|
|||
|
||||
//step forward
|
||||
bool yet_to_finish = step();
|
||||
get_history().step_front(get_history().get_front() + 1);
|
||||
_history.set_front(_history.get_front() + 1);
|
||||
if (yet_to_finish)
|
||||
{
|
||||
|
||||
if(_mode == mode_step_by_step)
|
||||
pause();
|
||||
else
|
||||
|
@ -173,10 +174,23 @@ ConcreteSimulation::step()
|
|||
|
||||
try
|
||||
{
|
||||
//step forward
|
||||
// step forward
|
||||
bool yet_to_finish = true;
|
||||
if (get_history().get_front() == get_history().get_size() - 1)
|
||||
yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy());
|
||||
if (_history.get_front() == _history.get_size() - 1)
|
||||
if(!_history.is_sealed())
|
||||
yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy());
|
||||
else
|
||||
yet_to_finish = false;
|
||||
|
||||
if (!yet_to_finish) _history.seal();
|
||||
|
||||
// since the simulation expects to be notified
|
||||
// of simulation termination when reaching the last environment
|
||||
// and the front will be updated just out of this method,
|
||||
// we have to make this horrible thing
|
||||
if (_history.get_front() == _history.get_size() - 2 && _history.is_sealed())
|
||||
yet_to_finish = false;
|
||||
|
||||
return yet_to_finish;
|
||||
}
|
||||
catch (const CPUPolicyException& e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue