gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
sc_gem5::Scheduler Class Reference

#include <scheduler.hh>

Classes

class  TimeSlot
 

Public Types

enum  Status {
  StatusOther = 0, StatusEvaluate, StatusUpdate, StatusDelta,
  StatusTiming, StatusPaused, StatusStopped
}
 
typedef std::list< ScEvent * > ScEvents
 
typedef std::list< TimeSlot * > TimeSlots
 

Public Member Functions

 Scheduler ()
 
 ~Scheduler ()
 
void clear ()
 
const std::string name () const
 
uint64_t numCycles ()
 
Processcurrent ()
 
void initPhase ()
 
void reg (Process *p)
 
void yield ()
 
void ready (Process *p)
 
void resume (Process *p)
 
bool suspend (Process *p)
 
void requestUpdate (Channel *c)
 
void asyncRequestUpdate (Channel *c)
 
void runNow (Process *p)
 
void runNext (Process *p)
 
void setEventQueue (EventQueue *_eq)
 
Tick getCurTick ()
 
Tick delayed (const ::sc_core::sc_time &delay)
 
void schedule (ScEvent *event, const ::sc_core::sc_time &delay)
 
void deschedule (ScEvent *event)
 
void completeTimeSlot (TimeSlot *ts)
 
bool pendingCurr ()
 
bool pendingFuture ()
 
Tick timeToPending ()
 
void runUpdate ()
 
void runDelta ()
 
void start (Tick max_tick, bool run_to_time)
 
void oneCycle ()
 
void schedulePause ()
 
void scheduleStop (bool finish_delta)
 
bool elaborationDone ()
 
void elaborationDone (bool b)
 
bool paused ()
 
bool stopped ()
 
bool inEvaluate ()
 
bool inUpdate ()
 
bool inDelta ()
 
bool inTiming ()
 
uint64_t changeStamp ()
 
void stepChangeStamp ()
 
void throwUp ()
 
Status status ()
 
void status (Status s)
 
void registerTraceFile (TraceFile *tf)
 
void unregisterTraceFile (TraceFile *tf)
 
TimeSlotacquireTimeSlot (Tick tick)
 
void releaseTimeSlot (TimeSlot *ts)
 

Private Member Functions

void schedule (::Event *event, Tick tick)
 
void schedule (::Event *event)
 
void deschedule (::Event *event)
 
ProcessgetNextReady ()
 
void runReady ()
 
void scheduleReadyEvent ()
 
void pause ()
 
void stop ()
 
bool starved ()
 
void scheduleStarvationEvent ()
 
void maxTickFunc ()
 
void timeAdvances ()
 
void scheduleTimeAdvancesEvent ()
 
void trace (bool delta)
 

Private Attributes

const typedef EventBase::Priority Priority
 
EventQueueeq
 
ScEvents deltas
 
TimeSlots timeSlots
 
std::stack< TimeSlot * > freeTimeSlots
 
EventWrapper< Scheduler, &Scheduler::runReadyreadyEvent
 
EventWrapper< Scheduler, &Scheduler::pausepauseEvent
 
EventWrapper< Scheduler, &Scheduler::stopstopEvent
 
const ::sc_core::sc_report_throwUp
 
EventWrapper< Scheduler, &Scheduler::pausestarvationEvent
 
bool _elaborationDone
 
bool _started
 
bool _stopNow
 
Status _status
 
Tick maxTick
 
Tick lastReadyTick
 
EventWrapper< Scheduler, &Scheduler::maxTickFuncmaxTickEvent
 
EventWrapper< Scheduler, &Scheduler::timeAdvancestimeAdvancesEvent
 
uint64_t _numCycles
 
uint64_t _changeStamp
 
Process_current
 
bool initDone
 
bool runToTime
 
bool runOnce
 
ProcessList initList
 
ProcessList readyListMethods
 
ProcessList readyListThreads
 
ChannelList updateList
 
ChannelList asyncUpdateList
 
std::mutex asyncListMutex
 
std::atomic< bool > hasAsyncUpdate
 
std::map<::Event *, TickeventsToSchedule
 
std::set< TraceFile * > traceFiles
 

Static Private Attributes

static Priority DefaultPriority = EventBase::Default_Pri
 
static Priority StopPriority = DefaultPriority - 1
 
static Priority PausePriority = DefaultPriority + 1
 
static Priority MaxTickPriority = DefaultPriority + 2
 
static Priority ReadyPriority = DefaultPriority + 3
 
static Priority StarvationPriority = ReadyPriority
 
static Priority TimeAdvancesPriority = EventBase::Maximum_Pri
 

Detailed Description

Definition at line 148 of file scheduler.hh.

Member Typedef Documentation

◆ ScEvents

Definition at line 151 of file scheduler.hh.

◆ TimeSlots

Definition at line 176 of file scheduler.hh.

Member Enumeration Documentation

◆ Status

Enumerator
StatusOther 
StatusEvaluate 
StatusUpdate 
StatusDelta 
StatusTiming 
StatusPaused 
StatusStopped 

Definition at line 366 of file scheduler.hh.

Constructor & Destructor Documentation

◆ Scheduler()

Scheduler::Scheduler ( )

Definition at line 46 of file scheduler.cc.

◆ ~Scheduler()

Scheduler::~Scheduler ( )

Definition at line 59 of file scheduler.cc.

References clear().

Member Function Documentation

◆ acquireTimeSlot()

TimeSlot* sc_gem5::Scheduler::acquireTimeSlot ( Tick  tick)
inline

Definition at line 401 of file scheduler.hh.

References freeTimeSlots, and ArmISA::ts.

Referenced by schedule().

◆ asyncRequestUpdate()

void Scheduler::asyncRequestUpdate ( Channel c)

◆ changeStamp()

uint64_t sc_gem5::Scheduler::changeStamp ( )
inline

◆ clear()

void Scheduler::clear ( )

◆ completeTimeSlot()

void sc_gem5::Scheduler::completeTimeSlot ( TimeSlot ts)
inline

◆ current()

Process* sc_gem5::Scheduler::current ( )
inline

◆ delayed()

Tick sc_gem5::Scheduler::delayed ( const ::sc_core::sc_time delay)
inline

Definition at line 247 of file scheduler.hh.

References getCurTick().

Referenced by sc_gem5::Event::notify(), and schedule().

◆ deschedule() [1/2]

void sc_gem5::Scheduler::deschedule ( ::Event event)
inlineprivate

Definition at line 447 of file scheduler.hh.

References EventQueue::deschedule(), eq, MipsISA::event, eventsToSchedule, and initDone.

◆ deschedule() [2/2]

void sc_gem5::Scheduler::deschedule ( ScEvent event)
inline

◆ elaborationDone() [1/2]

bool sc_gem5::Scheduler::elaborationDone ( )
inline

Definition at line 377 of file scheduler.hh.

References _elaborationDone.

Referenced by sc_core::sc_simcontext::elaboration_done(), and sc_gem5::Kernel::init().

◆ elaborationDone() [2/2]

void sc_gem5::Scheduler::elaborationDone ( bool  b)
inline

Definition at line 378 of file scheduler.hh.

References _elaborationDone, and ArmISA::b.

◆ getCurTick()

Tick sc_gem5::Scheduler::getCurTick ( )
inline

◆ getNextReady()

Process* sc_gem5::Scheduler::getNextReady ( )
inlineprivate

Definition at line 460 of file scheduler.hh.

References sc_gem5::NodeList< T >::getNext(), MipsISA::p, readyListMethods, and readyListThreads.

Referenced by runReady(), and yield().

◆ inDelta()

bool sc_gem5::Scheduler::inDelta ( )
inline

Definition at line 384 of file scheduler.hh.

References status(), and StatusDelta.

◆ inEvaluate()

bool sc_gem5::Scheduler::inEvaluate ( )
inline

Definition at line 382 of file scheduler.hh.

References status(), and StatusEvaluate.

Referenced by ready(), requestUpdate(), runNext(), and schedule().

◆ initPhase()

void Scheduler::initPhase ( )

◆ inTiming()

bool sc_gem5::Scheduler::inTiming ( )
inline

Definition at line 385 of file scheduler.hh.

References status(), and StatusTiming.

◆ inUpdate()

bool sc_gem5::Scheduler::inUpdate ( )
inline

Definition at line 383 of file scheduler.hh.

References status(), and StatusUpdate.

Referenced by sc_gem5::Event::notify(), and schedule().

◆ maxTickFunc()

void sc_gem5::Scheduler::maxTickFunc ( )
inlineprivate

Definition at line 498 of file scheduler.hh.

References _changeStamp, getCurTick(), lastReadyTick, and pause().

◆ name()

const std::string sc_gem5::Scheduler::name ( ) const
inline

Definition at line 183 of file scheduler.hh.

◆ numCycles()

uint64_t sc_gem5::Scheduler::numCycles ( )
inline

Definition at line 185 of file scheduler.hh.

References _numCycles.

Referenced by sc_core::sc_delta_count().

◆ oneCycle()

void Scheduler::oneCycle ( )

Definition at line 438 of file scheduler.cc.

References MaxTick, runOnce, scheduleReadyEvent(), and start().

Referenced by sc_core::sc_start().

◆ pause()

void Scheduler::pause ( )
private

◆ paused()

bool sc_gem5::Scheduler::paused ( )
inline

Definition at line 380 of file scheduler.hh.

References status(), and StatusPaused.

◆ pendingCurr()

bool sc_gem5::Scheduler::pendingCurr ( )
inline

◆ pendingFuture()

bool sc_gem5::Scheduler::pendingFuture ( )
inline

Definition at line 338 of file scheduler.hh.

References timeSlots.

Referenced by sc_core::sc_pending_activity_at_future_time(), and timeToPending().

◆ ready()

void Scheduler::ready ( Process p)

◆ reg()

void Scheduler::reg ( Process p)

◆ registerTraceFile()

void sc_gem5::Scheduler::registerTraceFile ( TraceFile tf)
inline

Definition at line 397 of file scheduler.hh.

References X86ISA::tf, and traceFiles.

Referenced by sc_core::sc_create_vcd_trace_file().

◆ releaseTimeSlot()

void sc_gem5::Scheduler::releaseTimeSlot ( TimeSlot ts)
inline

Definition at line 416 of file scheduler.hh.

References freeTimeSlots, and ArmISA::ts.

Referenced by sc_gem5::Scheduler::TimeSlot::releaseImpl().

◆ requestUpdate()

void Scheduler::requestUpdate ( Channel c)

◆ resume()

void Scheduler::resume ( Process p)

Definition at line 216 of file scheduler.cc.

References initDone, initList, MipsISA::p, sc_gem5::NodeList< T >::pushLast(), and ready().

Referenced by sc_gem5::Process::resume().

◆ runDelta()

void Scheduler::runDelta ( )

Definition at line 350 of file scheduler.cc.

References deltas, status(), StatusDelta, and throwUp().

Referenced by initPhase(), and runReady().

◆ runNext()

void sc_gem5::Scheduler::runNext ( Process p)
inline

◆ runNow()

void sc_gem5::Scheduler::runNow ( Process p)
inline

◆ runReady()

void Scheduler::runReady ( )
private

◆ runUpdate()

void Scheduler::runUpdate ( )

◆ schedule() [1/3]

void sc_gem5::Scheduler::schedule ( ::Event event)
inlineprivate

Definition at line 444 of file scheduler.hh.

References MipsISA::event, getCurTick(), and schedule().

Referenced by schedule().

◆ schedule() [2/3]

void sc_gem5::Scheduler::schedule ( ::Event event,
Tick  tick 
)
inlineprivate

Definition at line 436 of file scheduler.hh.

References eq, MipsISA::event, eventsToSchedule, initDone, and EventQueue::schedule().

◆ schedule() [3/3]

void sc_gem5::Scheduler::schedule ( ScEvent event,
const ::sc_core::sc_time delay 
)
inline

◆ schedulePause()

void Scheduler::schedulePause ( )

Definition at line 446 of file scheduler.cc.

References pauseEvent, and schedule().

Referenced by runReady(), and sc_core::sc_pause().

◆ scheduleReadyEvent()

void Scheduler::scheduleReadyEvent ( )
private

Definition at line 266 of file scheduler.cc.

References deschedule(), readyEvent, schedule(), and starvationEvent.

Referenced by oneCycle(), ready(), requestUpdate(), runNext(), and schedule().

◆ scheduleStarvationEvent()

void Scheduler::scheduleStarvationEvent ( )
private

Definition at line 277 of file scheduler.cc.

References deschedule(), readyEvent, schedule(), and starvationEvent.

Referenced by completeTimeSlot(), initPhase(), runReady(), and start().

◆ scheduleStop()

void Scheduler::scheduleStop ( bool  finish_delta)

Definition at line 469 of file scheduler.cc.

References _stopNow, clear(), schedule(), and stopEvent.

Referenced by sc_core::sc_stop(), and sc_gem5::Kernel::t0Handler().

◆ scheduleTimeAdvancesEvent()

void sc_gem5::Scheduler::scheduleTimeAdvancesEvent ( )
inlineprivate

Definition at line 509 of file scheduler.hh.

References schedule(), timeAdvancesEvent, and traceFiles.

Referenced by completeTimeSlot(), initPhase(), runReady(), and start().

◆ setEventQueue()

void sc_gem5::Scheduler::setEventQueue ( EventQueue _eq)
inline

Definition at line 241 of file scheduler.hh.

References eq.

Referenced by sc_gem5::Kernel::Kernel().

◆ start()

void Scheduler::start ( Tick  max_tick,
bool  run_to_time 
)

◆ starved()

bool sc_gem5::Scheduler::starved ( )
inlineprivate

◆ status() [1/2]

Status sc_gem5::Scheduler::status ( )
inline

◆ status() [2/2]

void sc_gem5::Scheduler::status ( Status  s)
inline

Definition at line 395 of file scheduler.hh.

References _status, and ArmISA::s.

◆ stepChangeStamp()

void sc_gem5::Scheduler::stepChangeStamp ( )
inline

Definition at line 388 of file scheduler.hh.

References _changeStamp.

Referenced by sc_gem5::Scheduler::TimeSlot::process().

◆ stop()

void Scheduler::stop ( )
private

◆ stopped()

bool sc_gem5::Scheduler::stopped ( )
inline

Definition at line 381 of file scheduler.hh.

References status(), and StatusStopped.

◆ suspend()

bool Scheduler::suspend ( Process p)

Definition at line 235 of file scheduler.cc.

References initDone, and MipsISA::p.

Referenced by sc_gem5::Process::suspend().

◆ throwUp()

void Scheduler::throwUp ( )

◆ timeAdvances()

void sc_gem5::Scheduler::timeAdvances ( )
inlineprivate

Definition at line 506 of file scheduler.hh.

References trace().

◆ timeToPending()

Tick sc_gem5::Scheduler::timeToPending ( )
inline

Definition at line 345 of file scheduler.hh.

References getCurTick(), MaxTick, pendingCurr(), pendingFuture(), and timeSlots.

◆ trace()

void Scheduler::trace ( bool  delta)
private

Definition at line 484 of file scheduler.cc.

References X86ISA::tf, and traceFiles.

Referenced by runReady(), and timeAdvances().

◆ unregisterTraceFile()

void sc_gem5::Scheduler::unregisterTraceFile ( TraceFile tf)
inline

Definition at line 398 of file scheduler.hh.

References X86ISA::tf, and traceFiles.

Referenced by sc_core::sc_close_vcd_trace_file().

◆ yield()

void Scheduler::yield ( )

Member Data Documentation

◆ _changeStamp

uint64_t sc_gem5::Scheduler::_changeStamp
private

Definition at line 516 of file scheduler.hh.

Referenced by changeStamp(), maxTickFunc(), runReady(), and stepChangeStamp().

◆ _current

Process* sc_gem5::Scheduler::_current
private

Definition at line 518 of file scheduler.hh.

Referenced by current(), runNow(), runReady(), and yield().

◆ _elaborationDone

bool sc_gem5::Scheduler::_elaborationDone
private

Definition at line 489 of file scheduler.hh.

Referenced by elaborationDone().

◆ _numCycles

uint64_t sc_gem5::Scheduler::_numCycles
private

Definition at line 515 of file scheduler.hh.

Referenced by numCycles(), and runReady().

◆ _started

bool sc_gem5::Scheduler::_started
private

Definition at line 490 of file scheduler.hh.

Referenced by initPhase(), and start().

◆ _status

Status sc_gem5::Scheduler::_status
private

Definition at line 493 of file scheduler.hh.

Referenced by status().

◆ _stopNow

bool sc_gem5::Scheduler::_stopNow
private

Definition at line 491 of file scheduler.hh.

Referenced by ready(), runReady(), and scheduleStop().

◆ _throwUp

const ::sc_core::sc_report* sc_gem5::Scheduler::_throwUp
private

Definition at line 475 of file scheduler.hh.

Referenced by start(), and throwUp().

◆ asyncListMutex

std::mutex sc_gem5::Scheduler::asyncListMutex
private

Definition at line 532 of file scheduler.hh.

Referenced by asyncRequestUpdate(), and runUpdate().

◆ asyncUpdateList

ChannelList sc_gem5::Scheduler::asyncUpdateList
private

Definition at line 531 of file scheduler.hh.

Referenced by asyncRequestUpdate(), and runUpdate().

◆ DefaultPriority

Priority sc_gem5::Scheduler::DefaultPriority = EventBase::Default_Pri
staticprivate

Definition at line 423 of file scheduler.hh.

◆ deltas

ScEvents sc_gem5::Scheduler::deltas
private

Definition at line 455 of file scheduler.hh.

Referenced by clear(), deschedule(), pendingCurr(), runDelta(), schedule(), and starved().

◆ eq

EventQueue* sc_gem5::Scheduler::eq
private

Definition at line 432 of file scheduler.hh.

Referenced by deschedule(), getCurTick(), initPhase(), schedule(), and setEventQueue().

◆ eventsToSchedule

std::map<::Event *, Tick> sc_gem5::Scheduler::eventsToSchedule
private

Definition at line 535 of file scheduler.hh.

Referenced by deschedule(), initPhase(), and schedule().

◆ freeTimeSlots

std::stack<TimeSlot*> sc_gem5::Scheduler::freeTimeSlots
private

Definition at line 457 of file scheduler.hh.

Referenced by acquireTimeSlot(), and releaseTimeSlot().

◆ hasAsyncUpdate

std::atomic<bool> sc_gem5::Scheduler::hasAsyncUpdate
private

Definition at line 533 of file scheduler.hh.

Referenced by asyncRequestUpdate(), and runUpdate().

◆ initDone

bool sc_gem5::Scheduler::initDone
private

Definition at line 520 of file scheduler.hh.

Referenced by deschedule(), initPhase(), reg(), resume(), schedule(), start(), and suspend().

◆ initList

ProcessList sc_gem5::Scheduler::initList
private

Definition at line 524 of file scheduler.hh.

Referenced by clear(), initPhase(), reg(), resume(), and starved().

◆ lastReadyTick

Tick sc_gem5::Scheduler::lastReadyTick
private

Definition at line 496 of file scheduler.hh.

Referenced by maxTickFunc(), runReady(), and start().

◆ maxTick

Tick sc_gem5::Scheduler::maxTick
private

Definition at line 495 of file scheduler.hh.

Referenced by start(), and starved().

◆ maxTickEvent

EventWrapper<Scheduler, &Scheduler::maxTickFunc> sc_gem5::Scheduler::maxTickEvent
private

Definition at line 504 of file scheduler.hh.

Referenced by clear(), and start().

◆ MaxTickPriority

Priority sc_gem5::Scheduler::MaxTickPriority = DefaultPriority + 2
staticprivate

Definition at line 427 of file scheduler.hh.

◆ pauseEvent

EventWrapper<Scheduler, &Scheduler::pause> sc_gem5::Scheduler::pauseEvent
private

Definition at line 472 of file scheduler.hh.

Referenced by clear(), schedulePause(), and start().

◆ PausePriority

Priority sc_gem5::Scheduler::PausePriority = DefaultPriority + 1
staticprivate

Definition at line 426 of file scheduler.hh.

◆ Priority

const typedef EventBase::Priority sc_gem5::Scheduler::Priority
private

Definition at line 422 of file scheduler.hh.

◆ readyEvent

EventWrapper<Scheduler, &Scheduler::runReady> sc_gem5::Scheduler::readyEvent
private

Definition at line 467 of file scheduler.hh.

Referenced by clear(), scheduleReadyEvent(), and scheduleStarvationEvent().

◆ readyListMethods

ProcessList sc_gem5::Scheduler::readyListMethods
private

Definition at line 526 of file scheduler.hh.

Referenced by clear(), getNextReady(), pendingCurr(), ready(), runNext(), runNow(), runReady(), and starved().

◆ readyListThreads

ProcessList sc_gem5::Scheduler::readyListThreads
private

Definition at line 527 of file scheduler.hh.

Referenced by clear(), getNextReady(), pendingCurr(), ready(), runReady(), and starved().

◆ ReadyPriority

Priority sc_gem5::Scheduler::ReadyPriority = DefaultPriority + 3
staticprivate

Definition at line 428 of file scheduler.hh.

◆ runOnce

bool sc_gem5::Scheduler::runOnce
private

Definition at line 522 of file scheduler.hh.

Referenced by oneCycle(), pause(), runReady(), and stop().

◆ runToTime

bool sc_gem5::Scheduler::runToTime
private

Definition at line 521 of file scheduler.hh.

Referenced by completeTimeSlot(), initPhase(), runReady(), and start().

◆ starvationEvent

EventWrapper<Scheduler, &Scheduler::pause> sc_gem5::Scheduler::starvationEvent
private

Definition at line 486 of file scheduler.hh.

Referenced by clear(), scheduleReadyEvent(), scheduleStarvationEvent(), and start().

◆ StarvationPriority

Priority sc_gem5::Scheduler::StarvationPriority = ReadyPriority
staticprivate

Definition at line 429 of file scheduler.hh.

◆ stopEvent

EventWrapper<Scheduler, &Scheduler::stop> sc_gem5::Scheduler::stopEvent
private

Definition at line 473 of file scheduler.hh.

Referenced by clear(), scheduleStop(), and start().

◆ StopPriority

Priority sc_gem5::Scheduler::StopPriority = DefaultPriority - 1
staticprivate

Definition at line 425 of file scheduler.hh.

◆ timeAdvancesEvent

EventWrapper<Scheduler, &Scheduler::timeAdvances> sc_gem5::Scheduler::timeAdvancesEvent
private

Definition at line 507 of file scheduler.hh.

Referenced by clear(), and scheduleTimeAdvancesEvent().

◆ TimeAdvancesPriority

Priority sc_gem5::Scheduler::TimeAdvancesPriority = EventBase::Maximum_Pri
staticprivate

Definition at line 430 of file scheduler.hh.

◆ timeSlots

TimeSlots sc_gem5::Scheduler::timeSlots
private

◆ traceFiles

std::set<TraceFile *> sc_gem5::Scheduler::traceFiles
private

◆ updateList

ChannelList sc_gem5::Scheduler::updateList
private

Definition at line 529 of file scheduler.hh.

Referenced by clear(), pendingCurr(), requestUpdate(), runUpdate(), and starved().


The documentation for this class was generated from the following files:

Generated on Tue Jun 22 2021 15:29:11 for gem5 by doxygen 1.8.17