- Updated interface of pyloader to comply with the new plugin management system`s requirements
- Commented a lot of code to make it compile-able. But still it doesn`t link (at least for me...) git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@710 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
b65adbe1cc
commit
401c569a9f
11 changed files with 751 additions and 719 deletions
|
@ -70,106 +70,106 @@ void
|
|||
Simulation::reset()
|
||||
{
|
||||
_state = state_paused;
|
||||
History::get_instance().truncate_at(0);
|
||||
//History::get_instance().truncate_at(0);
|
||||
}
|
||||
|
||||
void
|
||||
Simulation::run() throw(UserInterruptException)
|
||||
{
|
||||
History& h = History::get_instance();
|
||||
|
||||
switch(_state)
|
||||
{
|
||||
case state_running:
|
||||
// FIXME: write out something, or just ignore user input?
|
||||
return;
|
||||
case state_stopped:
|
||||
h.truncate_at(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_state = state_running;
|
||||
|
||||
//******* CONTINUOUS TIME
|
||||
|
||||
if (_mode)
|
||||
{
|
||||
do
|
||||
{
|
||||
// chech for termination
|
||||
bool all_term = true;
|
||||
smart_ptr<ReadyQueue> left = h.get_simulation_status_at(h.get_current_time());
|
||||
for(uint i = 0; i < left->size(); i++)
|
||||
if (left->get_item_at(i)->get_state() != DynamicSchedulable::state_terminated)
|
||||
{
|
||||
all_term = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//if there are no processes left the termination message has already been notified
|
||||
//by the last execution of upadate()
|
||||
if (all_term)
|
||||
{
|
||||
_state = state_stopped;
|
||||
return; // Exit from loop
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//step forward
|
||||
Scheduler::get_instance().step_forward();
|
||||
|
||||
//sleep
|
||||
Glib::usleep(_timer_interval*1000);
|
||||
|
||||
}
|
||||
catch(UserInterruptException e)
|
||||
{
|
||||
stop();
|
||||
throw;
|
||||
}
|
||||
|
||||
//check the state
|
||||
if (_state == state_stopped || _state == state_paused)
|
||||
return;
|
||||
|
||||
}
|
||||
while(true);
|
||||
}
|
||||
|
||||
//******* STEP by STEP
|
||||
else
|
||||
{
|
||||
// chech for termination
|
||||
bool all_term = true;
|
||||
smart_ptr<ReadyQueue> left = h.get_simulation_status_at(h.get_current_time());
|
||||
for(uint i = 0; i < left->size(); i++)
|
||||
if (left->get_item_at(i)->get_state() != DynamicSchedulable::state_terminated)
|
||||
{
|
||||
all_term = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (all_term)
|
||||
//if there are no processes left the termination message has already been notified
|
||||
//by the last execution of upadate()
|
||||
_state = state_paused;
|
||||
else
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
//step forward
|
||||
Scheduler::get_instance().step_forward();
|
||||
}
|
||||
catch(UserInterruptException e)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
// History& h = History::get_instance();
|
||||
//
|
||||
// switch(_state)
|
||||
// {
|
||||
// case state_running:
|
||||
// // FIXME: write out something, or just ignore user input?
|
||||
// return;
|
||||
// case state_stopped:
|
||||
// h.truncate_at(0);
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// _state = state_running;
|
||||
//
|
||||
// //******* CONTINUOUS TIME
|
||||
//
|
||||
// if (_mode)
|
||||
// {
|
||||
// do
|
||||
// {
|
||||
// // chech for termination
|
||||
// bool all_term = true;
|
||||
// smart_ptr<ReadyQueue> left = h.get_simulation_status_at(h.get_current_time());
|
||||
// for(uint i = 0; i < left->size(); i++)
|
||||
// if (left->get_item_at(i)->get_state() != DynamicSchedulable::state_terminated)
|
||||
// {
|
||||
// all_term = false;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// //if there are no processes left the termination message has already been notified
|
||||
// //by the last execution of upadate()
|
||||
// if (all_term)
|
||||
// {
|
||||
// _state = state_stopped;
|
||||
// return; // Exit from loop
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// //step forward
|
||||
// Scheduler::get_instance().step_forward();
|
||||
//
|
||||
// //sleep
|
||||
// Glib::usleep(_timer_interval*1000);
|
||||
//
|
||||
// }
|
||||
// catch(UserInterruptException e)
|
||||
// {
|
||||
// stop();
|
||||
// throw;
|
||||
// }
|
||||
//
|
||||
// //check the state
|
||||
// if (_state == state_stopped || _state == state_paused)
|
||||
// return;
|
||||
//
|
||||
// }
|
||||
// while(true);
|
||||
// }
|
||||
//
|
||||
// //******* STEP by STEP
|
||||
// else
|
||||
// {
|
||||
// // chech for termination
|
||||
// bool all_term = true;
|
||||
// smart_ptr<ReadyQueue> left = h.get_simulation_status_at(h.get_current_time());
|
||||
// for(uint i = 0; i < left->size(); i++)
|
||||
// if (left->get_item_at(i)->get_state() != DynamicSchedulable::state_terminated)
|
||||
// {
|
||||
// all_term = false;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (all_term)
|
||||
// //if there are no processes left the termination message has already been notified
|
||||
// //by the last execution of upadate()
|
||||
// _state = state_paused;
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// //step forward
|
||||
// Scheduler::get_instance().step_forward();
|
||||
// }
|
||||
// catch(UserInterruptException e)
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
@ -209,13 +209,14 @@ Simulation::set_policy(Policy* p)
|
|||
Policy*
|
||||
Simulation::get_policy()
|
||||
{
|
||||
return &Scheduler::get_instance().get_policy();
|
||||
//return &Scheduler::get_instance().get_policy();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vector<Policy*>
|
||||
Simulation::get_avaiable_policies()
|
||||
{
|
||||
vector<Policy*> v;
|
||||
v.push_back(&Scheduler::get_instance().get_policy());
|
||||
//v.push_back(&Scheduler::get_instance().get_policy());
|
||||
return v;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue