- Give code a round of indentation. Thank astyle, not me.
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@837 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
aaf8e068d3
commit
d3c7b46853
108 changed files with 3196 additions and 3180 deletions
|
@ -32,8 +32,8 @@ using namespace sgpem;
|
|||
using namespace memory;
|
||||
using Glib::usleep;
|
||||
|
||||
ConcreteSimulation::ConcreteSimulation() :
|
||||
_state(state_stopped), _mode(true), _timer_interval(1000), _policy(NULL)
|
||||
ConcreteSimulation::ConcreteSimulation() :
|
||||
_state(state_stopped), _mode(true), _timer_interval(1000), _policy(NULL)
|
||||
{}
|
||||
|
||||
void
|
||||
|
@ -75,7 +75,7 @@ ConcreteSimulation::stop()
|
|||
void
|
||||
ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException)
|
||||
{
|
||||
switch(_state)
|
||||
switch (_state)
|
||||
{
|
||||
case state_running:
|
||||
return;
|
||||
|
@ -88,57 +88,57 @@ ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException)
|
|||
|
||||
_state = state_running;
|
||||
|
||||
if(get_policy() == NULL)
|
||||
{
|
||||
stop();
|
||||
throw NullPolicyException("no policy selected");
|
||||
}
|
||||
|
||||
if (get_policy() == NULL)
|
||||
{
|
||||
stop();
|
||||
throw NullPolicyException("no policy selected");
|
||||
}
|
||||
|
||||
//******* CONTINUOUS TIME
|
||||
if (_mode)
|
||||
{
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
//step forward
|
||||
bool yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy());
|
||||
if(!yet_to_finish) stop();
|
||||
|
||||
//sleep
|
||||
Glib::usleep(_timer_interval*1000);
|
||||
}
|
||||
catch(UserInterruptException e)
|
||||
{
|
||||
stop();
|
||||
throw;
|
||||
}
|
||||
|
||||
//check the state
|
||||
if (_state == state_stopped || _state == state_paused)
|
||||
return;
|
||||
//step forward
|
||||
bool yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy());
|
||||
if (!yet_to_finish) stop();
|
||||
|
||||
//sleep
|
||||
Glib::usleep(_timer_interval*1000);
|
||||
}
|
||||
while(true);
|
||||
catch (UserInterruptException e)
|
||||
{
|
||||
stop();
|
||||
throw;
|
||||
}
|
||||
|
||||
//check the state
|
||||
if (_state == state_stopped || _state == state_paused)
|
||||
return;
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
|
||||
//******* STEP by STEP
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
assert(get_policy() != NULL);
|
||||
//step forward
|
||||
bool yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy());
|
||||
if(yet_to_finish)
|
||||
pause();
|
||||
else
|
||||
stop();
|
||||
}
|
||||
catch(UserInterruptException e)
|
||||
{
|
||||
{
|
||||
assert(get_policy() != NULL);
|
||||
//step forward
|
||||
bool yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy());
|
||||
if (yet_to_finish)
|
||||
pause();
|
||||
else
|
||||
stop();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (UserInterruptException e)
|
||||
{
|
||||
stop();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,8 @@ void
|
|||
ConcreteSimulation::set_policy(CPUPolicy* p)
|
||||
{
|
||||
_policy = p;
|
||||
|
||||
if(p != NULL)
|
||||
|
||||
if (p != NULL)
|
||||
CPUPoliciesGatekeeper::get_instance().activate_policy(&_history, p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue