gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::MemberEventWrapper< F > Class Template Referencefinal

Wrap a member function inside MemberEventWrapper to use it as an event callback. More...

#include <eventq.hh>

Inheritance diagram for gem5::MemberEventWrapper< F >:
gem5::Event gem5::Named gem5::EventBase gem5::Serializable

Public Member Functions

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

Private Types

using CLASS = MemberFunctionClass_t<F>
 

Private Attributes

CLASSmObject
 

Additional Inherited Members

- Public Types inherited from gem5::EventBase
typedef int8_t Priority
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 
- Static Public Attributes inherited from gem5::EventBase
static const Priority Minimum_Pri = SCHAR_MIN
 Event priorities, to provide tie-breakers for events scheduled at the same cycle.
 
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).
 
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.
 
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).
 
static const Priority Delayed_Writeback_Pri = -1
 For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which have default priority).
 
static const Priority Default_Pri = 0
 Default is zero for historical reasons.
 
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.
 
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.
 
static const Priority CPU_Tick_Pri = 50
 CPU ticks must come after other associated CPU events (such as writebacks).
 
static const Priority CPU_Exit_Pri = 64
 If we want to exit a thread in a CPU, it comes after CPU_Tick_Pri.
 
static const Priority Stat_Event_Pri = 90
 Statistics events (dump, reset, etc.) come after everything else, but before exit.
 
static const Priority Progress_Event_Pri = 95
 Progress events come at the end.
 
static const Priority Sim_Exit_Pri = 100
 If we want to exit on this cycle, it's the very last thing we do.
 
static const Priority Maximum_Pri = SCHAR_MAX
 Maximum priority.
 
- Protected Types inherited from gem5::EventBase
typedef unsigned short FlagsType
 
typedef ::gem5::Flags< FlagsTypeFlags
 
- Protected Member Functions inherited from gem5::Event
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.
 
const std::string instanceString () const
 Return the instance number as a string.
 
void acquire ()
 Memory management hooks for events that have the Managed flag set.
 
void release ()
 Managed event removed from the event queue.
 
virtual void acquireImpl ()
 
virtual void releaseImpl ()
 
- Static Protected Attributes inherited from gem5::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.
 
static const FlagsType IsExitEvent = 0x0010
 
static const FlagsType IsMainQueue = 0x0020
 
static const FlagsType Initialized = 0x7a40
 
static const FlagsType InitMask = 0xffc0
 

Detailed Description

template<auto F>
class gem5::MemberEventWrapper< F >

Wrap a member function inside MemberEventWrapper to use it as an event callback.

This wrapper should be prefered over EventFunctionWrapper for better performance and type safety.

Wrapping a function process member of a class klass can be done by adding a member variable of the following type: MemberEventWrapper<&klass::process>.

It is required that klass::process takes no explicit argument and returns no value as these could not be handled by the event scheduler.

Template Parameters
FPointer to the member function wrapped in this event.

Definition at line 1091 of file eventq.hh.

Member Typedef Documentation

◆ CLASS

template<auto F>
using gem5::MemberEventWrapper< F >::CLASS = MemberFunctionClass_t<F>
private

Definition at line 1093 of file eventq.hh.

Constructor & Destructor Documentation

◆ MemberEventWrapper() [1/2]

template<auto F>
gem5::MemberEventWrapper< F >::MemberEventWrapper ( CLASS * object,
bool del = false,
Priority p = Default_Pri )
inline

Definition at line 1099 of file eventq.hh.

◆ MemberEventWrapper() [2/2]

template<auto F>
gem5::MemberEventWrapper< F >::MemberEventWrapper ( CLASS & object,
bool del = false,
Priority p = Default_Pri )
inline

Construct a new MemberEventWrapper object.

Parameters
objectinstance of the object to call the wrapped member func on
delif true, flag this event as AutoDelete
ppriority of this event

Definition at line 1112 of file eventq.hh.

References gem5::EventBase::AutoDelete, gem5_assert, gem5::MemberEventWrapper< F >::mObject, and gem5::Event::setFlags().

Member Function Documentation

◆ description()

template<auto F>
const char * gem5::MemberEventWrapper< F >::description ( ) const
inlineoverridevirtual

Return a C string describing the event.

This string should not be dynamically allocated; just a const char array describing the event class.

Reimplemented from gem5::Event.

Definition at line 1127 of file eventq.hh.

◆ process()

template<auto F>
void gem5::MemberEventWrapper< F >::process ( )
inlineoverridevirtual

Implements gem5::Event.

Definition at line 1123 of file eventq.hh.

References gem5::MemberEventWrapper< F >::mObject.

Member Data Documentation

◆ mObject

template<auto F>
CLASS* gem5::MemberEventWrapper< F >::mObject
private

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

Generated on Tue Jun 18 2024 16:24:12 for gem5 by doxygen 1.11.0