gem5  v21.1.0.2
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 (gem5::EventQueue *_eq)
 
gem5::Tick getCurTick ()
 
gem5::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 ()
 
gem5::Tick timeToPending ()
 
void runUpdate ()
 
void runDelta ()
 
void start (gem5::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 (gem5::Tick tick)
 
void releaseTimeSlot (TimeSlot *ts)
 

Private Member Functions

void schedule (gem5::Event *event, gem5::Tick tick)
 
void schedule (gem5::Event *event)
 
void deschedule (gem5::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 gem5::EventBase::Priority Priority
 
gem5::EventQueueeq
 
ScEvents deltas
 
TimeSlots timeSlots
 
std::stack< TimeSlot * > freeTimeSlots
 
gem5::EventWrapper< Scheduler, &Scheduler::runReadyreadyEvent
 
gem5::EventWrapper< Scheduler, &Scheduler::pausepauseEvent
 
gem5::EventWrapper< Scheduler, &Scheduler::stopstopEvent
 
const ::sc_core::sc_report_throwUp
 
gem5::EventWrapper< Scheduler, &Scheduler::pausestarvationEvent
 
bool _elaborationDone
 
bool _started
 
bool _stopNow
 
Status _status
 
gem5::Tick maxTick
 
gem5::Tick lastReadyTick
 
gem5::EventWrapper< Scheduler, &Scheduler::maxTickFuncmaxTickEvent
 
gem5::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< gem5::Event *, gem5::TickeventsToSchedule
 
std::set< TraceFile * > traceFiles
 

Static Private Attributes

static Priority DefaultPriority = gem5::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 = gem5::EventBase::Maximum_Pri
 

Detailed Description

Definition at line 147 of file scheduler.hh.

Member Typedef Documentation

◆ ScEvents

Definition at line 150 of file scheduler.hh.

◆ TimeSlots

Definition at line 175 of file scheduler.hh.

Member Enumeration Documentation

◆ Status

Enumerator
StatusOther 
StatusEvaluate 
StatusUpdate 
StatusDelta 
StatusTiming 
StatusPaused 
StatusStopped 

Definition at line 367 of file scheduler.hh.

Constructor & Destructor Documentation

◆ Scheduler()

sc_gem5::Scheduler::Scheduler ( )

Definition at line 46 of file scheduler.cc.

◆ ~Scheduler()

sc_gem5::Scheduler::~Scheduler ( )

Definition at line 59 of file scheduler.cc.

References clear().

Member Function Documentation

◆ acquireTimeSlot()

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

Definition at line 402 of file scheduler.hh.

References freeTimeSlots, and gem5::ArmISA::ts.

Referenced by schedule().

◆ asyncRequestUpdate()

void sc_gem5::Scheduler::asyncRequestUpdate ( Channel c)

◆ changeStamp()

uint64_t sc_gem5::Scheduler::changeStamp ( )
inline

◆ clear()

void sc_gem5::Scheduler::clear ( )

◆ completeTimeSlot()

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

◆ current()

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

◆ delayed()

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

Definition at line 246 of file scheduler.hh.

References getCurTick().

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

◆ deschedule() [1/2]

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

◆ deschedule() [2/2]

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

◆ elaborationDone() [1/2]

bool sc_gem5::Scheduler::elaborationDone ( )
inline

Definition at line 378 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 379 of file scheduler.hh.

References _elaborationDone, and gem5::ArmISA::b.

◆ getCurTick()

gem5::Tick sc_gem5::Scheduler::getCurTick ( )
inline

◆ getNextReady()

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

Definition at line 461 of file scheduler.hh.

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

Referenced by runReady(), and yield().

◆ inDelta()

bool sc_gem5::Scheduler::inDelta ( )
inline

Definition at line 385 of file scheduler.hh.

References status(), and StatusDelta.

◆ inEvaluate()

bool sc_gem5::Scheduler::inEvaluate ( )
inline

Definition at line 383 of file scheduler.hh.

References status(), and StatusEvaluate.

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

◆ initPhase()

void sc_gem5::Scheduler::initPhase ( )

◆ inTiming()

bool sc_gem5::Scheduler::inTiming ( )
inline

Definition at line 386 of file scheduler.hh.

References status(), and StatusTiming.

◆ inUpdate()

bool sc_gem5::Scheduler::inUpdate ( )
inline

Definition at line 384 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 499 of file scheduler.hh.

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

◆ name()

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

Definition at line 182 of file scheduler.hh.

◆ numCycles()

uint64_t sc_gem5::Scheduler::numCycles ( )
inline

Definition at line 184 of file scheduler.hh.

References _numCycles.

Referenced by sc_core::sc_delta_count().

◆ oneCycle()

void sc_gem5::Scheduler::oneCycle ( )

Definition at line 442 of file scheduler.cc.

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

Referenced by sc_core::sc_start().

◆ pause()

void sc_gem5::Scheduler::pause ( )
private

◆ paused()

bool sc_gem5::Scheduler::paused ( )
inline

Definition at line 381 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 339 of file scheduler.hh.

References timeSlots.

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

◆ ready()

void sc_gem5::Scheduler::ready ( Process p)

◆ reg()

void sc_gem5::Scheduler::reg ( Process p)

◆ registerTraceFile()

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

Definition at line 398 of file scheduler.hh.

References gem5::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 417 of file scheduler.hh.

References freeTimeSlots, and gem5::ArmISA::ts.

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

◆ requestUpdate()

void sc_gem5::Scheduler::requestUpdate ( Channel c)

◆ resume()

void sc_gem5::Scheduler::resume ( Process p)

◆ runDelta()

void sc_gem5::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 sc_gem5::Scheduler::runReady ( )
private

◆ runUpdate()

void sc_gem5::Scheduler::runUpdate ( )

◆ schedule() [1/3]

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

Definition at line 445 of file scheduler.hh.

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

Referenced by schedule().

◆ schedule() [2/3]

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

◆ schedule() [3/3]

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

◆ schedulePause()

void sc_gem5::Scheduler::schedulePause ( )

Definition at line 450 of file scheduler.cc.

References pauseEvent, and schedule().

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

◆ scheduleReadyEvent()

void sc_gem5::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 sc_gem5::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 sc_gem5::Scheduler::scheduleStop ( bool  finish_delta)

Definition at line 473 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 510 of file scheduler.hh.

References schedule(), timeAdvancesEvent, and traceFiles.

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

◆ setEventQueue()

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

Definition at line 240 of file scheduler.hh.

References eq.

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

◆ start()

void sc_gem5::Scheduler::start ( gem5::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 396 of file scheduler.hh.

References _status, and gem5::ArmISA::s.

◆ stepChangeStamp()

void sc_gem5::Scheduler::stepChangeStamp ( )
inline

Definition at line 389 of file scheduler.hh.

References _changeStamp.

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

◆ stop()

void sc_gem5::Scheduler::stop ( )
private

◆ stopped()

bool sc_gem5::Scheduler::stopped ( )
inline

Definition at line 382 of file scheduler.hh.

References status(), and StatusStopped.

◆ suspend()

bool sc_gem5::Scheduler::suspend ( Process p)

Definition at line 235 of file scheduler.cc.

References initDone, and gem5::MipsISA::p.

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

◆ throwUp()

void sc_gem5::Scheduler::throwUp ( )

◆ timeAdvances()

void sc_gem5::Scheduler::timeAdvances ( )
inlineprivate

Definition at line 507 of file scheduler.hh.

References trace().

◆ timeToPending()

gem5::Tick sc_gem5::Scheduler::timeToPending ( )
inline

Definition at line 346 of file scheduler.hh.

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

◆ trace()

void sc_gem5::Scheduler::trace ( bool  delta)
private

Definition at line 488 of file scheduler.cc.

References gem5::X86ISA::tf, and traceFiles.

Referenced by runReady(), and timeAdvances().

◆ unregisterTraceFile()

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

Definition at line 399 of file scheduler.hh.

References gem5::X86ISA::tf, and traceFiles.

Referenced by sc_core::sc_close_vcd_trace_file().

◆ yield()

void sc_gem5::Scheduler::yield ( )

Member Data Documentation

◆ _changeStamp

uint64_t sc_gem5::Scheduler::_changeStamp
private

Definition at line 517 of file scheduler.hh.

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

◆ _current

Process* sc_gem5::Scheduler::_current
private

Definition at line 519 of file scheduler.hh.

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

◆ _elaborationDone

bool sc_gem5::Scheduler::_elaborationDone
private

Definition at line 490 of file scheduler.hh.

Referenced by elaborationDone().

◆ _numCycles

uint64_t sc_gem5::Scheduler::_numCycles
private

Definition at line 516 of file scheduler.hh.

Referenced by numCycles(), and runReady().

◆ _started

bool sc_gem5::Scheduler::_started
private

Definition at line 491 of file scheduler.hh.

Referenced by initPhase(), and start().

◆ _status

Status sc_gem5::Scheduler::_status
private

Definition at line 494 of file scheduler.hh.

Referenced by status().

◆ _stopNow

bool sc_gem5::Scheduler::_stopNow
private

Definition at line 492 of file scheduler.hh.

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

◆ _throwUp

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

Definition at line 476 of file scheduler.hh.

Referenced by start(), and throwUp().

◆ asyncListMutex

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

Definition at line 533 of file scheduler.hh.

Referenced by asyncRequestUpdate(), and runUpdate().

◆ asyncUpdateList

ChannelList sc_gem5::Scheduler::asyncUpdateList
private

Definition at line 532 of file scheduler.hh.

Referenced by asyncRequestUpdate(), and runUpdate().

◆ DefaultPriority

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

Definition at line 424 of file scheduler.hh.

◆ deltas

ScEvents sc_gem5::Scheduler::deltas
private

Definition at line 456 of file scheduler.hh.

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

◆ eq

gem5::EventQueue* sc_gem5::Scheduler::eq
private

Definition at line 433 of file scheduler.hh.

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

◆ eventsToSchedule

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

Definition at line 536 of file scheduler.hh.

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

◆ freeTimeSlots

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

Definition at line 458 of file scheduler.hh.

Referenced by acquireTimeSlot(), and releaseTimeSlot().

◆ hasAsyncUpdate

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

Definition at line 534 of file scheduler.hh.

Referenced by asyncRequestUpdate(), and runUpdate().

◆ initDone

bool sc_gem5::Scheduler::initDone
private

Definition at line 521 of file scheduler.hh.

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

◆ initList

ProcessList sc_gem5::Scheduler::initList
private

Definition at line 525 of file scheduler.hh.

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

◆ lastReadyTick

gem5::Tick sc_gem5::Scheduler::lastReadyTick
private

Definition at line 497 of file scheduler.hh.

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

◆ maxTick

gem5::Tick sc_gem5::Scheduler::maxTick
private

Definition at line 496 of file scheduler.hh.

Referenced by start(), and starved().

◆ maxTickEvent

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

Definition at line 505 of file scheduler.hh.

Referenced by clear(), and start().

◆ MaxTickPriority

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

Definition at line 428 of file scheduler.hh.

◆ pauseEvent

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

Definition at line 473 of file scheduler.hh.

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

◆ PausePriority

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

Definition at line 427 of file scheduler.hh.

◆ Priority

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

Definition at line 423 of file scheduler.hh.

◆ readyEvent

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

Definition at line 468 of file scheduler.hh.

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

◆ readyListMethods

ProcessList sc_gem5::Scheduler::readyListMethods
private

Definition at line 527 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 528 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 429 of file scheduler.hh.

◆ runOnce

bool sc_gem5::Scheduler::runOnce
private

Definition at line 523 of file scheduler.hh.

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

◆ runToTime

bool sc_gem5::Scheduler::runToTime
private

Definition at line 522 of file scheduler.hh.

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

◆ starvationEvent

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

Definition at line 487 of file scheduler.hh.

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

◆ StarvationPriority

Priority sc_gem5::Scheduler::StarvationPriority = ReadyPriority
staticprivate

Definition at line 430 of file scheduler.hh.

◆ stopEvent

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

Definition at line 474 of file scheduler.hh.

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

◆ StopPriority

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

Definition at line 426 of file scheduler.hh.

◆ timeAdvancesEvent

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

Definition at line 508 of file scheduler.hh.

Referenced by clear(), and scheduleTimeAdvancesEvent().

◆ TimeAdvancesPriority

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

Definition at line 431 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 530 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 Sep 21 2021 12:35:16 for gem5 by doxygen 1.8.17