- Substitute the old SchedulableQueue with the new ReadyQueue
- Add interfaces for Process and Thread into the "sgpem.i" SWIG interface file, change DynamicSchedulable into Schedulable - Add dynamic_cast for the return value of ReadyQueue::get_item_at() into the pyloader "sgpem.i" SWIG interface, so that a Schedulable can be either recognized as a Thread or a Process - TODO: wrap STL exceptions in SWIG interface - Please note that code won't compile until the new History and Scheduler::step_forward() will be in place. This is a known issue. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@689 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
fa06e2f4f1
commit
759b90b017
24 changed files with 170 additions and 414 deletions
|
@ -31,9 +31,9 @@ using namespace sgpem;
|
|||
smart_ptr<DynamicSchedulable> scheduled_at = smart_ptr<DynamicSchedulable>();
|
||||
if (0 <= time && time <= _total_time_elapsed)
|
||||
{
|
||||
smart_ptr<SchedulableQueue> sl = get_simulation_status_at(time);
|
||||
smart_ptr<ReadyQueue> sl = get_simulation_status_at(time);
|
||||
bool found = false;
|
||||
bool invalid = sl == smart_ptr<SchedulableQueue>();
|
||||
bool invalid = sl == smart_ptr<ReadyQueue>();
|
||||
for (uint i = 0; !found && !invalid && i < sl->size(); i++)
|
||||
{
|
||||
const DynamicSchedulable* ss = sl->get_item_at(i);
|
||||
|
@ -48,19 +48,19 @@ using namespace sgpem;
|
|||
}
|
||||
|
||||
|
||||
memory::smart_ptr<sgpem::SchedulableQueue>
|
||||
memory::smart_ptr<sgpem::ReadyQueue>
|
||||
History::get_simulation_status_at(int time) const
|
||||
{
|
||||
using namespace memory;
|
||||
smart_ptr<SchedulableQueue> simulation_status_at = smart_ptr<SchedulableQueue>();
|
||||
smart_ptr<ReadyQueue> simulation_status_at = smart_ptr<ReadyQueue>();
|
||||
if (0 <= time && time <= _total_time_elapsed)
|
||||
{
|
||||
if (_slice == memory::smart_ptr<Slice>())
|
||||
std::cout<<"History::get_simulation_status_at.NULL.error";
|
||||
else
|
||||
simulation_status_at = memory::smart_ptr<SchedulableQueue>
|
||||
simulation_status_at = memory::smart_ptr<ReadyQueue>
|
||||
(
|
||||
new SchedulableQueue
|
||||
new ReadyQueue
|
||||
(
|
||||
*(_slice->get_simulation_status())
|
||||
)
|
||||
|
@ -78,7 +78,7 @@ using namespace sgpem;
|
|||
|
||||
|
||||
void
|
||||
History::enqueue_slice(const sgpem::SchedulableQueue& status)
|
||||
History::enqueue_slice(const sgpem::ReadyQueue& status)
|
||||
{
|
||||
_slice = memory::smart_ptr<Slice>(new Slice(_total_time_elapsed, 1, status));
|
||||
_total_time_elapsed++;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "backend/observed_subject.hh"
|
||||
#include "backend/slice.hh"
|
||||
#include "backend/schedulable_queue.hh"
|
||||
#include "backend/ready_queue.hh"
|
||||
#include "templates/smartp.tcc"
|
||||
#include <iostream>
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace sgpem
|
|||
|
||||
/** Returns the last recorded instant, but may raise an error.
|
||||
*/
|
||||
memory::smart_ptr<sgpem::SchedulableQueue>
|
||||
memory::smart_ptr<sgpem::ReadyQueue>
|
||||
get_simulation_status_at(int time) const;
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace sgpem
|
|||
/** Extends the recorded history by one unit, overwriting the old value
|
||||
*/
|
||||
void
|
||||
enqueue_slice(const sgpem::SchedulableQueue& status);
|
||||
enqueue_slice(const sgpem::ReadyQueue& status);
|
||||
|
||||
|
||||
/** STUB: THIS FEATURE IS NOT AVAILABLE
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <iostream>
|
||||
#include "backend/static_process.hh"
|
||||
#include "backend/observed_subject.hh"
|
||||
#include "backend/schedulable_queue.hh"
|
||||
#include "backend/ready_queue.hh"
|
||||
#include "backend/dynamic_schedulable.hh"
|
||||
#include "templates/smartp.tcc"
|
||||
#include "backend/user_interrupt_exception.hh"
|
||||
|
|
|
@ -53,7 +53,7 @@ PRRPolicy::configure()
|
|||
PRRPolicy::sort_queue() const
|
||||
throw(UserInterruptException)
|
||||
{
|
||||
SchedulableQueue* local_sl = Scheduler::get_instance().get_ready_queue();
|
||||
ReadyQueue* local_sl = Scheduler::get_instance().get_ready_queue();
|
||||
for (uint useless = 0; useless < local_sl->size(); useless++)
|
||||
for (uint i = 0; i < local_sl->size() - 1; i++)
|
||||
if
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "backend/policy.hh"
|
||||
#include "backend/user_interrupt_exception.hh"
|
||||
#include "backend/schedulable_queue.hh"
|
||||
#include "backend/ready_queue.hh"
|
||||
#include "backend/scheduler.hh"
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue