gem5  v20.1.0.0
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 ComputeUnit::ScalarDataPort::MemReqEvent CountedExitEvent CPUProgressEvent DefaultFetch< Impl >::FinishTranslationEvent DmaReadFifo::DmaDoneEvent DVFSHandler::UpdateEvent EventFunctionWrapper EventWrapper< T, F > EventWrapper< A9GlobalTimer::Timer, &Timer::counterAtCmpVal > EventWrapper< BaseRemoteGDB, &BaseRemoteGDB::singleStep > EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates > EventWrapper< QoS::MemSinkCtrl, &MemSinkCtrl::processNextReqEvent > EventWrapper< sc_gem5::Kernel, &Kernel::t0Handler > EventWrapper< sc_gem5::Scheduler, &Scheduler::maxTickFunc > EventWrapper< sc_gem5::Scheduler, &Scheduler::pause > EventWrapper< sc_gem5::Scheduler, &Scheduler::runReady > EventWrapper< sc_gem5::Scheduler, &Scheduler::stop > EventWrapper< sc_gem5::Scheduler, &Scheduler::timeAdvances > EventWrapper< SMMUv3, &SMMUv3::processCommands > EventWrapper< SMMUv3DeviceInterface, &SMMUv3DeviceInterface::atsSendDeviceRetry > HSAPacketProcessor::CmdQueueCmdDmaEvent HSAPacketProcessor::DepSignalsReadDmaEvent HSAPacketProcessor::QueueProcessEvent HSAPacketProcessor::UpdateReadDispIdDmaEvent HWScheduler::SchedulerWakeupEvent InstructionQueue< Impl >::FUCompletion Intel8254Timer::Counter::CounterEvent LdsState::TickEvent LocalSimLoopExitEvent LSQUnit< Impl >::WritebackEvent MC146818::RTCEvent MC146818::RTCTickEvent PyEvent RegisterFile::RegisterEvent sc_gem5::Scheduler::TimeSlot SMMUDeviceRetryEvent TimingSimpleCPU::IprEvent TimingSimpleCPU::TimingCPUPort::TickEvent Trace::TarmacParserRecord::TarmacParserRecordEvent X86ISA::GpuTLB::TLBEvent

Public Member Functions

 Event (Priority p=Default_Pri, Flags f=0)
 
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
 The function returns true if the object is automatically deleted after the event is processed. More...
 
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...
 
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...
 
- 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
 
bool isFlagSet (Flags _flags) const
 
void setFlags (Flags _flags)
 
void clearFlags (Flags _flags)
 
void clearFlags ()
 
virtual void trace (const char *action)
 This function isn't really useful if TRACING_ON is not defined. More...
 
const std::string instanceString () const
 Return the instance number as a string. 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 ()
 Gets the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 Serializes all the SimObjects. More...
 
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 CPU_Exit_Pri = 64
 If we want to exit a thread in a CPU, it comes after CPU_Tick_Pri. 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...
 
- 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 246 of file eventq.hh.

Constructor & Destructor Documentation

◆ Event()

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

Definition at line 409 of file eventq.hh.

References curTick(), ArmISA::f, instance, instanceCounter, EventBase::PublicWrite, and queue.

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 378 of file eventq.hh.

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

◆ acquireImpl()

virtual void Event::acquireImpl ( )
inlineprotectedvirtual

Reimplemented in PyEvent.

Definition at line 392 of file eventq.hh.

Referenced by acquire().

◆ clearFlags() [1/2]

void Event::clearFlags ( )
inlineprotected

Definition at line 337 of file eventq.hh.

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

◆ clearFlags() [2/2]

void Event::clearFlags ( Flags  _flags)
inlineprotected

Definition at line 330 of file eventq.hh.

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

◆ getFlags()

Flags Event::getFlags ( ) const
inlineprotected

Definition at line 310 of file eventq.hh.

References flags, and 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 515 of file eventq.hh.

Referenced by simulate().

◆ initialized()

bool Event::initialized ( ) const
inlineprivate

Definition at line 303 of file eventq.hh.

References flags, EventBase::Initialized, and EventBase::InitMask.

◆ insertBefore()

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

Definition at line 90 of file eventq.cc.

References MipsISA::event, nextBin, and nextInBin.

Referenced by EventQueue::insert().

◆ instanceString()

const std::string Event::instanceString ( ) const
protected

Return the instance number as a string.

Definition at line 394 of file eventq.cc.

References csprintf().

◆ isFlagSet()

bool Event::isFlagSet ( Flags  _flags) const
inlineprotected

◆ process()

virtual void Event::process ( )
pure virtual

Implemented in HSAPacketProcessor::UpdateReadDispIdDmaEvent, BasePixelPump::PixelEvent, CountedExitEvent, LocalSimLoopExitEvent, PyEvent, EventFunctionWrapper, EventWrapper< T, F >, EventWrapper< A9GlobalTimer::Timer, &Timer::counterAtCmpVal >, EventWrapper< sc_gem5::Scheduler, &Scheduler::timeAdvances >, EventWrapper< sc_gem5::Kernel, &Kernel::t0Handler >, EventWrapper< sc_gem5::Scheduler, &Scheduler::stop >, EventWrapper< BaseRemoteGDB, &BaseRemoteGDB::singleStep >, EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates >, EventWrapper< sc_gem5::Scheduler, &Scheduler::maxTickFunc >, EventWrapper< sc_gem5::Scheduler, &Scheduler::pause >, EventWrapper< sc_gem5::Scheduler, &Scheduler::runReady >, EventWrapper< SMMUv3, &SMMUv3::processCommands >, EventWrapper< SMMUv3DeviceInterface, &SMMUv3DeviceInterface::atsSendDeviceRetry >, EventWrapper< QoS::MemSinkCtrl, &MemSinkCtrl::processNextReqEvent >, ComputeUnit::ScalarDataPort::MemReqEvent, DmaReadFifo::DmaDoneEvent, LSQUnit< Impl >::WritebackEvent, HSAPacketProcessor::CmdQueueCmdDmaEvent, X86ISA::GpuTLB::TLBEvent, HSAPacketProcessor::DepSignalsReadDmaEvent, TimingSimpleCPU::IprEvent, HSAPacketProcessor::QueueProcessEvent, DVFSHandler::UpdateEvent, BaseRemoteGDB::TrapEvent, GlobalSyncEvent::BarrierEvent, GlobalEvent::BarrierEvent, DefaultFetch< Impl >::FinishTranslationEvent, sc_gem5::Scheduler::TimeSlot, LdsState::TickEvent, InstructionQueue< Impl >::FUCompletion, Trace::TarmacParserRecord::TarmacParserRecordEvent, RegisterFile::MarkRegBusyScbEvent, CPUProgressEvent, RegisterFile::MarkRegFreeScbEvent, Intel8254Timer::Counter::CounterEvent, MC146818::RTCTickEvent, HWScheduler::SchedulerWakeupEvent, MC146818::RTCEvent, and SMMUDeviceRetryEvent.

◆ release()

void Event::release ( )
inlineprotected

Managed event removed from the event queue.

Definition at line 387 of file eventq.hh.

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

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

◆ releaseImpl()

virtual void Event::releaseImpl ( )
inlineprotectedvirtual

Reimplemented in PyEvent.

Definition at line 394 of file eventq.hh.

References scheduled().

Referenced by release().

◆ removeItem()

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

Definition at line 134 of file eventq.cc.

References MipsISA::event, nextBin, nextInBin, and panic.

Referenced by EventQueue::remove().

◆ 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 238 of file eventq.cc.

References SERIALIZE_SCALAR.

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

◆ setFlags()

void Event::setFlags ( Flags  _flags)
inlineprotected

◆ setWhen()

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

Definition at line 291 of file eventq.hh.

References _when, curTick(), ArmISA::q, queue, and when().

◆ 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 247 of file eventq.cc.

References DPRINTF, name(), and UNSERIALIZE_SCALAR.

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

Friends And Related Function Documentation

◆ EventQueue

friend class EventQueue
friend

Definition at line 248 of file eventq.hh.

Member Data Documentation

◆ _priority

Priority Event::_priority
private

event priority

Definition at line 267 of file eventq.hh.

Referenced by priority().

◆ _when

Tick Event::_when
private

timestamp when event should be processed

Definition at line 266 of file eventq.hh.

Referenced by setWhen(), and when().

◆ 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 278 of file eventq.hh.

Referenced by Event().

◆ instanceCounter

Counter Event::instanceCounter = 0
staticprivate

Global counter to generate unique IDs for Event instances.

Definition at line 272 of file eventq.hh.

Referenced by Event().

◆ 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 282 of file eventq.hh.

Referenced by Event(), and setWhen().


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

Generated on Wed Sep 30 2020 14:02:24 for gem5 by doxygen 1.8.17