|
gem5
v21.2.1.1
|
Global system counter. More...
#include <generic_timer.hh>
Public Member Functions | |
| SystemCounter (const SystemCounterParams &p) | |
| bool | enabled () const |
| Indicates if the counter is enabled. More... | |
| uint32_t | freq () const |
| Returns the counter frequency. More... | |
| uint64_t | value () |
| Updates and returns the counter value. More... | |
| uint64_t | increment () const |
| Returns the value increment. More... | |
| std::vector< uint32_t > & | freqTable () |
| Returns a reference to the frequency modes table. More... | |
| size_t | activeFreqEntry () const |
| Returns the currently active frequency table entry. More... | |
| Tick | period () const |
| Returns the counter period. More... | |
| void | enable () |
| Enables the counter after a CNTCR.EN == 1. More... | |
| void | disable () |
| Disables the counter after a CNTCR.EN == 0. More... | |
| void | freqUpdateSchedule (size_t new_freq_entry) |
| Schedules a counter frequency update after a CNTCR.FCREQ == 1 This complies with frequency transitions as per the architecture. More... | |
| void | setValue (uint64_t new_value) |
| Sets the value explicitly from writes to CNTCR.CNTCV. More... | |
| void | registerListener (SystemCounterListener *listener) |
| Called from System Counter Listeners to register. More... | |
| Tick | whenValue (uint64_t target_val) |
| Returns the tick at which a certain counter value is reached. More... | |
| Tick | whenValue (uint64_t cur_val, uint64_t target_val) const |
| void | serialize (CheckpointOut &cp) const override |
| Serialize an object. More... | |
| void | unserialize (CheckpointIn &cp) override |
| Unserialize an object. More... | |
Public Member Functions inherited from gem5::SimObject | |
| const Params & | params () const |
| SimObject (const Params &p) | |
| virtual | ~SimObject () |
| virtual void | init () |
| init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
| virtual void | loadState (CheckpointIn &cp) |
| loadState() is called on each SimObject when restoring from a checkpoint. More... | |
| virtual void | initState () |
| initState() is called on each SimObject when not restoring from a checkpoint. More... | |
| virtual void | regProbePoints () |
| Register probe points for this object. More... | |
| virtual void | regProbeListeners () |
| Register probe listeners for this object. More... | |
| ProbeManager * | getProbeManager () |
| Get the probe manager for this object. More... | |
| virtual Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) |
| Get a port with a given name and index. More... | |
| virtual void | startup () |
| startup() is the final initialization call before simulation. More... | |
| DrainState | drain () override |
| Provide a default implementation of the drain interface for objects that don't need draining. More... | |
| virtual void | memWriteback () |
| Write back dirty buffers to memory using functional writes. More... | |
| virtual void | memInvalidate () |
| Invalidate the contents of memory buffers. 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 gem5::EventManager | |
| EventQueue * | eventQueue () const |
| void | schedule (Event &event, Tick when) |
| void | deschedule (Event &event) |
| void | reschedule (Event &event, Tick when, bool always=false) |
| void | schedule (Event *event, Tick when) |
| void | deschedule (Event *event) |
| void | reschedule (Event *event, Tick when, bool always=false) |
| void | wakeupEventQueue (Tick when=(Tick) -1) |
| This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
| void | setCurTick (Tick newVal) |
| EventManager (EventManager &em) | |
| Event manger manages events in the event queue. More... | |
| EventManager (EventManager *em) | |
| EventManager (EventQueue *eq) | |
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. 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) |
Public Member Functions inherited from gem5::Drainable | |
| DrainState | drainState () const |
| Return the current drain state of an object. More... | |
| virtual void | notifyFork () |
| Notify a child process of a fork. More... | |
Public Member Functions inherited from gem5::statistics::Group | |
| Group (Group *parent, const char *name=nullptr) | |
| Construct a new statistics group. More... | |
| virtual | ~Group () |
| virtual void | regStats () |
| Callback to set stat parameters. More... | |
| virtual void | resetStats () |
| Callback to reset stats. More... | |
| virtual void | preDumpStats () |
| Callback before stats are dumped. More... | |
| void | addStat (statistics::Info *info) |
| Register a stat with this group. More... | |
| const std::map< std::string, Group * > & | getStatGroups () const |
| Get all child groups associated with this object. More... | |
| const std::vector< Info * > & | getStats () const |
| Get all stats associated with this object. More... | |
| void | addStatGroup (const char *name, Group *block) |
| Add a stat block as a child of this block. More... | |
| const Info * | resolveStat (std::string name) const |
| Resolve a stat by its name within this group. More... | |
| void | mergeStatGroup (Group *block) |
| Merge the contents (stats & children) of a block to this block. More... | |
| Group ()=delete | |
| Group (const Group &)=delete | |
| Group & | operator= (const Group &)=delete |
Public Member Functions inherited from gem5::Named | |
| Named (const std::string &name_) | |
| virtual | ~Named ()=default |
| virtual std::string | name () const |
Static Public Member Functions | |
| static void | validateCounterRef (SystemCounter *sys_cnt) |
| Validates a System Counter reference. More... | |
Static Public Member Functions inherited from gem5::SimObject | |
| static void | serializeAll (const std::string &cpt_dir) |
| Create a checkpoint by serializing all SimObjects in the system. More... | |
| static SimObject * | find (const char *name) |
| Find the SimObject with the given name and return a pointer to it. More... | |
| static void | setSimObjectResolver (SimObjectResolver *resolver) |
| There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More... | |
| static SimObjectResolver * | getSimObjectResolver () |
| There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More... | |
Static Public Member Functions inherited from gem5::Serializable | |
| static const std::string & | currentSection () |
| Gets the fully-qualified name of the active section. More... | |
| static void | generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream) |
| Generate a checkpoint file so that the serialization can be routed to it. More... | |
Protected Attributes | |
| bool | _enabled |
| Indicates if the counter is enabled. More... | |
| uint32_t | _freq |
| Counter frequency (as specified by CNTFRQ). More... | |
| uint64_t | _value |
| Counter value (as specified in CNTCV). More... | |
| uint64_t | _increment |
| Value increment in each counter cycle. More... | |
| std::vector< uint32_t > | _freqTable |
| Frequency modes table with all possible frequencies for the counter. More... | |
| size_t | _activeFreqEntry |
| Currently selected entry in the table, its contents should match _freq. More... | |
| Tick | _period |
| Cached copy of the counter period (inverse of the frequency). More... | |
| Tick | _updateTick |
| Counter cycle start Tick when the counter status affecting its value has been updated. More... | |
| std::vector< SystemCounterListener * > | _listeners |
| Listeners to changes in counting speed. More... | |
Protected Attributes inherited from gem5::SimObject | |
| const SimObjectParams & | _params |
| Cached copy of the object parameters. More... | |
Protected Attributes inherited from gem5::EventManager | |
| EventQueue * | eventq |
| A pointer to this object's event queue. More... | |
Static Protected Attributes | |
| static constexpr size_t | MAX_FREQ_ENTRIES = 1004 |
| Maximum architectural number of frequency table entries. More... | |
Private Member Functions | |
| SystemCounter (const SystemCounter &c) | |
| void | freqUpdateCallback () |
| Callback for the frequency update. More... | |
| void | updateValue (void) |
| Updates the counter value. More... | |
| void | updateTick (void) |
| Updates the update tick, normalizes to the lower cycle start tick. More... | |
| void | notifyListeners (void) const |
| Notifies counting speed changes to listeners. More... | |
Private Attributes | |
| EventFunctionWrapper | _freqUpdateEvent |
| Frequency update event handling. More... | |
| size_t | _nextFreqEntry |
Additional Inherited Members | |
Public Types inherited from gem5::SimObject | |
| typedef SimObjectParams | Params |
Protected Member Functions inherited from gem5::Drainable | |
| Drainable () | |
| virtual | ~Drainable () |
| virtual void | drainResume () |
| Resume execution after a successful drain. More... | |
| void | signalDrainDone () const |
| Signal that an object is drained. More... | |
Global system counter.
It is shared by the architected and memory-mapped timers.
Definition at line 86 of file generic_timer.hh.
| gem5::SystemCounter::SystemCounter | ( | const SystemCounterParams & | p | ) |
Definition at line 63 of file generic_timer.cc.
References freqUpdateCallback().
|
private |
|
inline |
Returns the currently active frequency table entry.
Definition at line 131 of file generic_timer.hh.
References _activeFreqEntry.
Referenced by gem5::GenericTimerMem::counterCtrlRead(), and gem5::GenericTimerMem::counterCtrlWrite().
| void gem5::SystemCounter::disable | ( | ) |
Disables the counter after a CNTCR.EN == 0.
Definition at line 102 of file generic_timer.cc.
References _enabled, DPRINTF, and updateValue().
Referenced by gem5::GenericTimerMem::counterCtrlWrite().
| void gem5::SystemCounter::enable | ( | ) |
Enables the counter after a CNTCR.EN == 1.
Definition at line 94 of file generic_timer.cc.
References _enabled, DPRINTF, and updateTick().
Referenced by gem5::GenericTimerMem::counterCtrlWrite().
|
inline |
Indicates if the counter is enabled.
Definition at line 121 of file generic_timer.hh.
References _enabled.
Referenced by gem5::GenericTimerMem::counterCtrlRead(), and gem5::GenericTimerMem::counterCtrlWrite().
|
inline |
Returns the counter frequency.
Definition at line 123 of file generic_timer.hh.
References _freq.
Referenced by gem5::GenericTimer::setMiscReg(), gem5::GenericTimerMem::timerCtrlRead(), gem5::GenericTimerMem::timerCtrlWrite(), and gem5::GenericTimerFrame::timerRead().
|
inline |
Returns a reference to the frequency modes table.
Definition at line 129 of file generic_timer.hh.
References _freqTable.
Referenced by gem5::GenericTimerMem::counterCtrlRead(), and gem5::GenericTimerMem::counterCtrlWrite().
|
private |
Callback for the frequency update.
Definition at line 187 of file generic_timer.cc.
References _activeFreqEntry, _enabled, _freq, _freqTable, _increment, _nextFreqEntry, _period, DPRINTF, gem5::sim_clock::Frequency, notifyListeners(), and updateValue().
Referenced by SystemCounter().
| void gem5::SystemCounter::freqUpdateSchedule | ( | size_t | new_freq_entry | ) |
Schedules a counter frequency update after a CNTCR.FCREQ == 1 This complies with frequency transitions as per the architecture.
| new_freq_entry | Index in CNTFID of the new freq |
Definition at line 169 of file generic_timer.cc.
References _freq, _freqTable, _freqUpdateEvent, _increment, _nextFreqEntry, gem5::EventManager::reschedule(), value(), and whenValue().
Referenced by gem5::GenericTimerMem::counterCtrlWrite().
|
inline |
Returns the value increment.
Definition at line 127 of file generic_timer.hh.
References _increment.
|
private |
Notifies counting speed changes to listeners.
Definition at line 207 of file generic_timer.cc.
References _listeners.
Referenced by freqUpdateCallback(), and setValue().
|
inline |
| void gem5::SystemCounter::registerListener | ( | SystemCounterListener * | listener | ) |
Called from System Counter Listeners to register.
Definition at line 201 of file generic_timer.cc.
References _listeners.
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
| cp | Checkpoint state |
Implements gem5::Serializable.
Definition at line 214 of file generic_timer.cc.
References _activeFreqEntry, _enabled, _freq, _freqTable, _freqUpdateEvent, _increment, _nextFreqEntry, _updateTick, _value, DPRINTF, gem5::Event::scheduled(), SERIALIZE_CONTAINER, SERIALIZE_SCALAR, and gem5::Event::when().
| void gem5::SystemCounter::setValue | ( | uint64_t | new_value | ) |
Sets the value explicitly from writes to CNTCR.CNTCV.
Definition at line 129 of file generic_timer.cc.
References _enabled, _value, notifyListeners(), updateTick(), and warn.
Referenced by gem5::GenericTimerMem::counterCtrlWrite().
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
| cp | Checkpoint state |
Implements gem5::Serializable.
Definition at line 234 of file generic_timer.cc.
References _activeFreqEntry, _enabled, _freq, _freqTable, _freqUpdateEvent, _increment, _nextFreqEntry, _period, _updateTick, _value, DPRINTF, gem5::sim_clock::Frequency, gem5::EventManager::reschedule(), UNSERIALIZE_CONTAINER, and UNSERIALIZE_SCALAR.
|
private |
Updates the update tick, normalizes to the lower cycle start tick.
Definition at line 163 of file generic_timer.cc.
References _period, _updateTick, and gem5::curTick().
Referenced by enable(), setValue(), and updateValue().
|
private |
Updates the counter value.
Definition at line 118 of file generic_timer.cc.
References _increment, _period, _updateTick, _value, gem5::curTick(), and updateTick().
Referenced by disable(), freqUpdateCallback(), and value().
|
static |
Validates a System Counter reference.
| sys_cnt | System counter reference to validate |
Definition at line 87 of file generic_timer.cc.
References fatal_if.
Referenced by gem5::GenericTimer::GenericTimer().
| uint64_t gem5::SystemCounter::value | ( | ) |
Updates and returns the counter value.
Definition at line 110 of file generic_timer.cc.
References _enabled, _value, and updateValue().
Referenced by gem5::GenericTimerMem::counterCtrlRead(), gem5::GenericTimerMem::counterCtrlWrite(), gem5::GenericTimerMem::counterStatusRead(), freqUpdateSchedule(), gem5::GenericWatchdog::refresh(), gem5::ArchTimer::value(), and whenValue().
| Tick gem5::SystemCounter::whenValue | ( | uint64_t | cur_val, |
| uint64_t | target_val | ||
| ) | const |
Definition at line 139 of file generic_timer.cc.
References _increment, _period, and gem5::curTick().
| Tick gem5::SystemCounter::whenValue | ( | uint64_t | target_val | ) |
Returns the tick at which a certain counter value is reached.
Definition at line 157 of file generic_timer.cc.
References value().
Referenced by freqUpdateSchedule(), gem5::GenericWatchdog::refresh(), and gem5::ArchTimer::whenValue().
|
protected |
Currently selected entry in the table, its contents should match _freq.
Definition at line 100 of file generic_timer.hh.
Referenced by activeFreqEntry(), freqUpdateCallback(), serialize(), and unserialize().
|
protected |
Indicates if the counter is enabled.
Definition at line 90 of file generic_timer.hh.
Referenced by disable(), enable(), enabled(), freqUpdateCallback(), serialize(), setValue(), unserialize(), and value().
|
protected |
Counter frequency (as specified by CNTFRQ).
Definition at line 92 of file generic_timer.hh.
Referenced by freq(), freqUpdateCallback(), freqUpdateSchedule(), serialize(), and unserialize().
|
protected |
Frequency modes table with all possible frequencies for the counter.
Definition at line 98 of file generic_timer.hh.
Referenced by freqTable(), freqUpdateCallback(), freqUpdateSchedule(), serialize(), and unserialize().
|
private |
Frequency update event handling.
Definition at line 163 of file generic_timer.hh.
Referenced by freqUpdateSchedule(), serialize(), and unserialize().
|
protected |
Value increment in each counter cycle.
Definition at line 96 of file generic_timer.hh.
Referenced by freqUpdateCallback(), freqUpdateSchedule(), increment(), serialize(), unserialize(), updateValue(), and whenValue().
|
protected |
Listeners to changes in counting speed.
Definition at line 108 of file generic_timer.hh.
Referenced by notifyListeners(), and registerListener().
|
private |
Definition at line 164 of file generic_timer.hh.
Referenced by freqUpdateCallback(), freqUpdateSchedule(), serialize(), and unserialize().
|
protected |
Cached copy of the counter period (inverse of the frequency).
Definition at line 102 of file generic_timer.hh.
Referenced by freqUpdateCallback(), period(), unserialize(), updateTick(), updateValue(), and whenValue().
|
protected |
Counter cycle start Tick when the counter status affecting its value has been updated.
Definition at line 105 of file generic_timer.hh.
Referenced by serialize(), unserialize(), updateTick(), and updateValue().
|
protected |
Counter value (as specified in CNTCV).
Definition at line 94 of file generic_timer.hh.
Referenced by serialize(), setValue(), unserialize(), updateValue(), and value().
|
staticconstexprprotected |
Maximum architectural number of frequency table entries.
Definition at line 111 of file generic_timer.hh.