gem5
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Event Class Referenceabstract

#include <eventq.hh>

Inheritance diagram for Event:
EventBase Serializable BaseGlobalEvent::BarrierEvent BasePixelPump::PixelEvent BaseRemoteGDB::TrapEvent CountedExitEvent CpuEvent DefaultFetch< Impl >::FinishTranslationEvent DmaReadFifo::DmaDoneEvent DVFSHandler::UpdateEvent EndQuiesceEvent EventFunctionWrapper EventWrapper< T, F > EventWrapper< A9GlobalTimer::Timer, &Timer::counterAtCmpVal > EventWrapper< BaseRemoteGDB, &BaseRemoteGDB::singleStep > InstructionQueue< Impl >::FUCompletion Intel8254Timer::Counter::CounterEvent LdsState::TickEvent LocalSimLoopExitEvent LSQUnit< Impl >::WritebackEvent MC146818::RTCEvent MC146818::RTCTickEvent PyEvent TimingSimpleCPU::IprEvent TimingSimpleCPU::TimingCPUPort::TickEvent Trace::TarmacParserRecord::TarmacParserRecordEvent X86ISA::GpuTLB::TLBEvent

Public Member Functions

 Event (Priority p=Default_Pri, Flags f=0)
 
virtual ~Event ()
 
virtual const std::string name () const
 
virtual const char * description () const
 Return a C string describing the event. More...
 
void dump () const
 Dump the current event data. More...
 
virtual void process ()=0
 
bool scheduled () const
 Determine if the current event is scheduled. More...
 
void squash ()
 Squash the current event. More...
 
bool squashed () const
 Check whether the event is squashed. More...
 
bool isExitEvent () const
 See if this is a SimExitEvent (without resorting to RTTI) More...
 
bool isManaged () const
 Check whether this event will auto-delete. More...
 
bool isAutoDelete () const
 
Tick when () const
 Get the time that the event is scheduled. More...
 
Priority priority () const
 Get the event priority. More...
 
virtual BaseGlobalEventglobalEvent ()
 If this is part of a GlobalEvent, return the pointer to the Global Event. More...
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
- Public Member Functions inherited from Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Protected Member Functions

Flags getFlags () const
 Accessor for flags. More...
 
bool isFlagSet (Flags _flags) const
 
void setFlags (Flags _flags)
 Accessor for flags. More...
 
void clearFlags (Flags _flags)
 
void clearFlags ()
 
virtual void trace (const char *action)
 trace event activity More...
 
void acquire ()
 Memory management hooks for events that have the Managed flag set. More...
 
void release ()
 Managed event removed from the event queue. More...
 
virtual void acquireImpl ()
 
virtual void releaseImpl ()
 

Private Member Functions

void setWhen (Tick when, EventQueue *q)
 
bool initialized () const
 

Static Private Member Functions

static EventinsertBefore (Event *event, Event *curr)
 
static EventremoveItem (Event *event, Event *last)
 

Private Attributes

EventnextBin
 
EventnextInBin
 
Tick _when
 timestamp when event should be processed More...
 
Priority _priority
 event priority More...
 
Flags flags
 
Counter instance
 This event's unique ID. More...
 
EventQueuequeue
 queue to which this event belongs (though it may or may not be scheduled on this queue yet) More...
 

Static Private Attributes

static Counter instanceCounter = 0
 Global counter to generate unique IDs for Event instances. More...
 

Friends

class EventQueue
 

Additional Inherited Members

- Public Types inherited from EventBase
typedef int8_t Priority
 
- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Get the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 
static void unserializeGlobals (CheckpointIn &cp)
 
- Static Public Attributes inherited from EventBase
static const Priority Minimum_Pri = SCHAR_MIN
 Event priorities, to provide tie-breakers for events scheduled at the same cycle. More...
 
static const Priority Debug_Enable_Pri = -101
 If we enable tracing on a particular cycle, do that as the very first thing so we don't miss any of the events on that cycle (even if we enter the debugger). More...
 
static const Priority Debug_Break_Pri = -100
 Breakpoints should happen before anything else (except enabling trace output), so we don't miss any action when debugging. More...
 
static const Priority CPU_Switch_Pri = -31
 CPU switches schedule the new CPU's tick event for the same cycle (after unscheduling the old CPU's tick event). More...
 
static const Priority Delayed_Writeback_Pri = -1
 For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which have default priority). More...
 
static const Priority Default_Pri = 0
 Default is zero for historical reasons. More...
 
static const Priority DVFS_Update_Pri = 31
 DVFS update event leads to stats dump therefore given a lower priority to ensure all relevant states have been updated. More...
 
static const Priority Serialize_Pri = 32
 Serailization needs to occur before tick events also, so that a serialize/unserialize is identical to an on-line CPU switch. More...
 
static const Priority CPU_Tick_Pri = 50
 CPU ticks must come after other associated CPU events (such as writebacks). More...
 
static const Priority Stat_Event_Pri = 90
 Statistics events (dump, reset, etc.) come after everything else, but before exit. More...
 
static const Priority Progress_Event_Pri = 95
 Progress events come at the end. More...
 
static const Priority Sim_Exit_Pri = 100
 If we want to exit on this cycle, it's the very last thing we do. More...
 
static const Priority Maximum_Pri = SCHAR_MAX
 Maximum priority. More...
 
- Static Public Attributes inherited from Serializable
static int ckptCount = 0
 
static int ckptMaxCount = 0
 
static int ckptPrevCount = -1
 
- Protected Types inherited from EventBase
typedef unsigned short FlagsType
 
typedef ::Flags< FlagsTypeFlags
 
- Static Protected Attributes inherited from EventBase
static const FlagsType PublicRead = 0x003f
 
static const FlagsType PublicWrite = 0x001d
 
static const FlagsType Squashed = 0x0001
 
static const FlagsType Scheduled = 0x0002
 
static const FlagsType Managed = 0x0004
 
static const FlagsType AutoDelete = Managed
 
static const FlagsType Reserved0 = 0x0008
 This used to be AutoSerialize. More...
 
static const FlagsType IsExitEvent = 0x0010
 
static const FlagsType IsMainQueue = 0x0020
 
static const FlagsType Initialized = 0x7a40
 
static const FlagsType InitMask = 0xffc0
 

Detailed Description

Definition at line 186 of file eventq.hh.

Constructor & Destructor Documentation

◆ Event()

Event::Event ( Priority  p = Default_Pri,
Flags  f = 0 
)
inline

Definition at line 342 of file eventq.hh.

References curTick(), Stats::dump(), ArmISA::f, name(), and EventBase::PublicWrite.

Referenced by TapListener::listen().

◆ ~Event()

Event::~Event ( )
virtual

Definition at line 79 of file eventq.cc.

Member Function Documentation

◆ acquire()

void Event::acquire ( )
inlineprotected

Memory management hooks for events that have the Managed flag set.

Events can use automatic memory management by setting the Managed flag. The default implementation automatically deletes events once they have been removed from the event queue. This typically happens when events are descheduled or have been triggered and not rescheduled.

The methods below may be overridden by events that need custom memory management. For example, events exported to Python need to impement reference counting to ensure that the Python implementation of the event is kept alive while it lives in the event queue.

Note
Memory managers are responsible for implementing reference counting (by overriding both acquireImpl() and releaseImpl()) or checking if an event is no longer scheduled in releaseImpl() before deallocating it. Managed event scheduled and being held in the event queue.

Definition at line 313 of file eventq.hh.

References Flags< T >::isSet(), and EventBase::Managed.

◆ acquireImpl()

virtual void Event::acquireImpl ( )
inlineprotectedvirtual

Reimplemented in PyEvent.

Definition at line 327 of file eventq.hh.

◆ clearFlags() [1/2]

void Event::clearFlags ( Flags  _flags)
inlineprotected

Definition at line 272 of file eventq.hh.

References Flags< T >::clear(), Flags< T >::noneSet(), and EventBase::PublicWrite.

◆ clearFlags() [2/2]

void Event::clearFlags ( )
inlineprotected

Definition at line 279 of file eventq.hh.

References Flags< T >::clear(), and EventBase::PublicWrite.

◆ description()

const char * Event::description ( ) const
virtual

◆ dump()

void Event::dump ( ) const

Dump the current event data.

Definition at line 399 of file eventq.cc.

References cprintf(), EventQueue::EventQueue(), ArmISA::n, and name().

Referenced by EventQueue::debugVerify(), EventQueue::dump(), and pybind_init_event().

◆ getFlags()

Flags Event::getFlags ( ) const
inlineprotected

Accessor for flags.

Definition at line 251 of file eventq.hh.

References EventBase::PublicRead.

◆ globalEvent()

virtual BaseGlobalEvent* Event::globalEvent ( )
inlinevirtual

If this is part of a GlobalEvent, return the pointer to the Global Event.

By default, there is no GlobalEvent, so return NULL. (Overridden in GlobalEvent::BarrierEvent.)

Reimplemented in BaseGlobalEvent::BarrierEvent.

Definition at line 406 of file eventq.hh.

References serialize(), and unserialize().

Referenced by simulate().

◆ initialized()

bool Event::initialized ( ) const
inlineprivate

◆ insertBefore()

Event * Event::insertBefore ( Event event,
Event curr 
)
staticprivate

Definition at line 97 of file eventq.cc.

References MipsISA::event, nextBin, and nextInBin.

Referenced by EventQueue::insert().

◆ isAutoDelete()

bool Event::isAutoDelete ( ) const
inline

Definition at line 395 of file eventq.hh.

Referenced by RubySystem::memWriteback().

◆ isExitEvent()

bool Event::isExitEvent ( ) const
inline

See if this is a SimExitEvent (without resorting to RTTI)

Definition at line 391 of file eventq.hh.

References EventBase::IsExitEvent, and Flags< T >::isSet().

Referenced by pybind_init_event().

◆ isFlagSet()

bool Event::isFlagSet ( Flags  _flags) const
inlineprotected

Definition at line 257 of file eventq.hh.

References Flags< T >::isSet(), Flags< T >::noneSet(), and EventBase::PublicRead.

◆ isManaged()

bool Event::isManaged ( ) const
inline

Check whether this event will auto-delete.

Definition at line 394 of file eventq.hh.

References Flags< T >::isSet(), and EventBase::Managed.

◆ name()

const std::string Event::name ( ) const
virtual

◆ priority()

Priority Event::priority ( ) const
inline

Get the event priority.

Definition at line 401 of file eventq.hh.

Referenced by EventQueue::debugVerify(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and pybind_init_event().

◆ process()

virtual void Event::process ( )
pure virtual

◆ release()

void Event::release ( )
inlineprotected

Managed event removed from the event queue.

Definition at line 322 of file eventq.hh.

References Flags< T >::isSet(), and EventBase::Managed.

Referenced by BaseGlobalEvent::BarrierEvent::globalBarrier().

◆ releaseImpl()

virtual void Event::releaseImpl ( )
inlineprotectedvirtual

Reimplemented in PyEvent.

Definition at line 329 of file eventq.hh.

◆ removeItem()

Event * Event::removeItem ( Event event,
Event last 
)
staticprivate

Definition at line 141 of file eventq.cc.

References nextBin, nextInBin, and panic.

Referenced by EventQueue::remove().

◆ scheduled()

bool Event::scheduled ( ) const
inline

Determine if the current event is scheduled.

Definition at line 382 of file eventq.hh.

References Flags< T >::isSet(), and EventBase::Scheduled.

Referenced by DRAMSim2::accessAndRespond(), FlashDevice::accessDevice(), DRAMCtrl::activateBank(), BaseKvmCPU::activateContext(), AtomicSimpleCPU::activateContext(), TimingSimpleCPU::activateContext(), DRAMCtrl::addToReadQueue(), DRAMCtrl::addToWriteQueue(), IGbE::chkInterrupt(), HDLcd::cmdDisable(), IGbE::cpuPostInt(), EventQueue::deschedule(), BaseRemoteGDB::descheduleInstCommitEvent(), Shader::dispatch_workgroups(), DmaPort::dmaAction(), Pl111::dmaDone(), FlashDevice::drain(), BaseKvmCPU::drain(), AtomicSimpleCPU::drain(), ArchTimer::drain(), TrafficGen::drain(), BasePixelPump::PixelEvent::drain(), TimingSimpleCPU::drain(), FullO3CPU< O3CPUImpl >::drain(), IGbE::drain(), DRAMCtrl::drain(), BaseKvmCPU::drainResume(), AtomicSimpleCPU::drainResume(), TimingSimpleCPU::drainResume(), FullO3CPU< O3CPUImpl >::drainResume(), IGbE::ethRxPkt(), BaseKvmCPU::finishMMIOPending(), DefaultFetch< Impl >::finishTranslation(), X86ISA::GpuTLB::handleTranslationReturn(), IGbE::DescCache< iGbReg::RxDesc >::hasOutstandingEvents(), IGbE::RxDescCache::hasOutstandingEvents(), IGbE::TxDescCache::hasOutstandingEvents(), BaseRemoteGDB::incomingData(), Sequencer::insertRequest(), GPUCoalescer::insertRequest(), DefaultFetch< Impl >::isDrained(), TimingSimpleCPU::isDrained(), VIPERCoalescer::makeRequest(), GPUCoalescer::makeRequest(), BaseKvmCPU::notifyFork(), GpuDispatcher::notifyWgCompl(), DVFSHandler::perfLevel(), IGbE::RxDescCache::pktComplete(), IGbE::TxDescCache::pktComplete(), IGbE::postInterrupt(), DRAMCtrl::prechargeBank(), LdsState::process(), DRAMCtrl::processNextReqEvent(), DRAMCtrl::Rank::processPowerEvent(), DRAMCtrl::Rank::processRefreshEvent(), DRAMCtrl::processRespondEvent(), pybind_init_event(), UFSHostDevice::readDevice(), Pl111::readFramebuffer(), SimpleMemory::recvTimingReq(), X86ISA::Walker::recvTimingResp(), EventQueue::reschedule(), IGbE::restartClock(), Sp804::Timer::restartCounter(), CpuLocalTimer::Timer::restartTimerCounter(), CpuLocalTimer::Timer::restartWatchdogCounter(), BasePixelPump::PixelEvent::resume(), PL031::resyncMatch(), EtherTapBase::retransmit(), LdsState::returnQueuePush(), NSGigE::rxKick(), TraceCPU::schedDcacheNextEvent(), PacketQueue::schedSendEvent(), EventQueue::schedule(), GpuDispatcher::scheduleDispatch(), Uart8250::scheduleIntr(), DRAMCtrl::Rank::schedulePowerEvent(), FullO3CPU< O3CPUImpl >::scheduleTickEvent(), DRAMSim2::sendResponse(), EtherTapBase::sendSimulated(), ThreadState::serialize(), EtherSwitch::Interface::serialize(), GpuDispatcher::serialize(), Uart8250::serialize(), EtherLink::Link::serialize(), Sp804::Timer::serialize(), PL031::serialize(), EnergyCtrl::serialize(), CpuLocalTimer::Timer::serialize(), SparcISA::ISA::serialize(), Intel8254Timer::Counter::serialize(), TrafficGen::serialize(), BasePixelPump::PixelEvent::serialize(), Sinic::Device::serialize(), NSGigE::serialize(), IdeDisk::serialize(), Pl111::serialize(), IGbE::serialize(), Pl011::setInterrupts(), BaseRemoteGDB::setSingleStep(), BaseRemoteGDB::singleStep(), Ticked::start(), Pl111::startDma(), MC146818::startup(), Ticked::stop(), BasePixelPump::stop(), BasePixelPump::PixelEvent::suspend(), BaseKvmCPU::suspendContext(), AtomicSimpleCPU::suspendContext(), TimingSimpleCPU::suspendContext(), BaseKvmCPU::switchOut(), AtomicSimpleCPU::switchOut(), TimingSimpleCPU::switchOut(), BaseKvmCPU::takeOverFrom(), AtomicSimpleCPU::takeOverFrom(), FullO3CPU< O3CPUImpl >::takeOverFrom(), GarnetSyntheticTraffic::tick(), FullO3CPU< O3CPUImpl >::tick(), UFSHostDevice::transferHandler(), EtherSwitch::Interface::transmit(), NSGigE::transmit(), FullO3CPU< O3CPUImpl >::tryDrain(), EtherLink::Link::txDone(), NSGigE::txKick(), FullO3CPU< O3CPUImpl >::unscheduleTickEvent(), GpuDispatcher::unserialize(), Intel8254Timer::Counter::unserialize(), BasePixelPump::PixelEvent::unserialize(), ArchTimer::updateCounter(), TLBCoalescer::updatePhysAddresses(), FullO3CPU< O3CPUImpl >::wakeCPU(), Uart8250::write(), EnergyCtrl::write(), GpuDispatcher::write(), Intel8254Timer::Counter::write(), MC146818::writeData(), UFSHostDevice::writeDevice(), and AtomicSimpleCPU::~AtomicSimpleCPU().

◆ serialize()

void Event::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements Serializable.

Reimplemented in LocalSimLoopExitEvent.

Definition at line 244 of file eventq.cc.

References SERIALIZE_SCALAR.

Referenced by Intel8254Timer::outputHigh(), LocalSimLoopExitEvent::serialize(), and BasePixelPump::PixelEvent::serialize().

◆ setFlags()

void Event::setFlags ( Flags  _flags)
inlineprotected

Accessor for flags.

Definition at line 265 of file eventq.hh.

References Flags< T >::noneSet(), EventBase::PublicWrite, and Flags< T >::set().

Referenced by DmaReadFifo::DmaDoneEvent::kill().

◆ setWhen()

void Event::setWhen ( Tick  when,
EventQueue q 
)
inlineprivate

Definition at line 231 of file eventq.hh.

References curTick(), and ArmISA::q.

◆ squash()

void Event::squash ( )
inline

◆ squashed()

bool Event::squashed ( ) const
inline

Check whether the event is squashed.

Definition at line 388 of file eventq.hh.

References Flags< T >::isSet(), and EventBase::Squashed.

Referenced by pybind_init_event(), and FullO3CPU< O3CPUImpl >::scheduleTickEvent().

◆ trace()

void Event::trace ( const char *  action)
protectedvirtual

trace event activity

Definition at line 384 of file eventq.cc.

References DPRINTFN.

Referenced by Trace::TarmacParser::TarmacParser(), and Trace::TarmacParser::~TarmacParser().

◆ unserialize()

void Event::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements Serializable.

Reimplemented in LocalSimLoopExitEvent.

Definition at line 253 of file eventq.cc.

References DPRINTF, name(), and UNSERIALIZE_SCALAR.

Referenced by Intel8254Timer::outputHigh(), LocalSimLoopExitEvent::unserialize(), and BasePixelPump::PixelEvent::unserialize().

◆ when()

Tick Event::when ( ) const
inline

Friends And Related Function Documentation

◆ EventQueue

friend class EventQueue
friend

Definition at line 188 of file eventq.hh.

Member Data Documentation

◆ _priority

Priority Event::_priority
private

event priority

Definition at line 207 of file eventq.hh.

◆ _when

Tick Event::_when
private

timestamp when event should be processed

Definition at line 206 of file eventq.hh.

◆ flags

Flags Event::flags
private

◆ instance

Counter Event::instance
private

This event's unique ID.

We can also use pointer values for this but they're not consistent across runs making debugging more difficult. Thus we use a global counter value when debugging.

Definition at line 218 of file eventq.hh.

◆ instanceCounter

Counter Event::instanceCounter = 0
staticprivate

Global counter to generate unique IDs for Event instances.

Definition at line 212 of file eventq.hh.

Referenced by getEventQueue().

◆ nextBin

Event* Event::nextBin
private

◆ nextInBin

Event* Event::nextInBin
private

◆ queue

EventQueue* Event::queue
private

queue to which this event belongs (though it may or may not be scheduled on this queue yet)

Definition at line 222 of file eventq.hh.

Referenced by EventQueue::remove().


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

Generated on Fri Apr 20 2018 09:05:06 for gem5 by doxygen 1.8.13