|
gem5
v19.0.0.0
|
Global system counter. More...
#include <generic_timer.hh>
Public Member Functions | |
| SystemCounter (std::vector< uint32_t > &freqs) | |
| uint64_t | value () const |
| Returns the current value of the physical counter. More... | |
| uint32_t | freq () const |
| Returns the counter frequency. More... | |
| void | setFreq (uint32_t freq) |
| Sets the counter frequency. More... | |
| Tick | period () const |
| Returns the counter period. More... | |
| void | setKernelControl (uint32_t val) |
| uint32_t | getKernelControl () |
| void | setHypControl (uint32_t val) |
| uint32_t | getHypControl () |
| 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 Attributes | |
| uint32_t | _freq |
| Counter frequency (as specified by CNTFRQ). More... | |
| std::vector< uint32_t > | _freqTable |
| Frequency modes table with all possible frequencies for the counter. More... | |
| Tick | _period |
| Cached copy of the counter period (inverse of the frequency). More... | |
| Tick | _resetTick |
| Tick when the counter was reset. More... | |
| uint32_t | _regCntkctl |
| Kernel event stream control register. More... | |
| uint32_t | _regCnthctl |
| Hypervisor event stream control register. 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) | |
Additional Inherited Members | |
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 Serializable | |
| static int | ckptCount = 0 |
| static int | ckptMaxCount = 0 |
| static int | ckptPrevCount = -1 |
Global system counter.
It is shared by the architected timers.
Definition at line 63 of file generic_timer.hh.
| SystemCounter::SystemCounter | ( | std::vector< uint32_t > & | freqs | ) |
Definition at line 51 of file generic_timer.cc.
References _freq, _freqTable, _period, fatal_if, SimClock::Frequency, and MAX_FREQ_ENTRIES.
Referenced by getHypControl().
|
private |
|
inline |
Returns the counter frequency.
Definition at line 95 of file generic_timer.hh.
References _freq, and setFreq().
Referenced by GenericTimerMem::ctrlRead(), GenericTimer::readMiscReg(), setFreq(), and GenericTimerMem::timerRead().
|
inline |
Definition at line 107 of file generic_timer.hh.
References _regCnthctl, ArmISA::c, serialize(), SystemCounter(), and unserialize().
Referenced by GenericTimer::readMiscReg().
|
inline |
Definition at line 104 of file generic_timer.hh.
References _regCntkctl.
Referenced by GenericTimer::readMiscReg().
|
inline |
Returns the counter period.
Definition at line 101 of file generic_timer.hh.
References _period.
Referenced by ArchTimer::updateCounter().
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
| cp | Checkpoint state |
Implements Serializable.
Definition at line 81 of file generic_timer.cc.
References _freq, _period, _regCnthctl, _regCntkctl, _resetTick, and SERIALIZE_SCALAR.
Referenced by getHypControl(), and ArchTimer::offset().
| void SystemCounter::setFreq | ( | uint32_t | freq | ) |
Sets the counter frequency.
| freq | frequency in Hz. |
Definition at line 69 of file generic_timer.cc.
References _freq, _period, _resetTick, curTick(), freq(), SimClock::Frequency, and warn_once.
Referenced by freq(), and GenericTimer::setMiscReg().
|
inline |
Definition at line 106 of file generic_timer.hh.
References X86ISA::val.
Referenced by GenericTimer::setMiscReg().
|
inline |
Definition at line 103 of file generic_timer.hh.
References X86ISA::val.
Referenced by GenericTimer::setMiscReg().
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
| cp | Checkpoint state |
Implements Serializable.
Definition at line 91 of file generic_timer.cc.
References _freq, _period, _regCnthctl, _regCntkctl, _resetTick, UNSERIALIZE_OPT_SCALAR, and UNSERIALIZE_SCALAR.
Referenced by getHypControl(), and ArchTimer::offset().
|
inline |
Returns the current value of the physical counter.
Definition at line 87 of file generic_timer.hh.
References _period, and curTick().
Referenced by GenericTimerMem::getAddrRanges(), ArchTimer::offset(), ArchTimer::timerValue(), and ArchTimer::value().
|
protected |
Counter frequency (as specified by CNTFRQ).
Definition at line 67 of file generic_timer.hh.
Referenced by freq(), serialize(), setFreq(), SystemCounter(), and unserialize().
|
protected |
Frequency modes table with all possible frequencies for the counter.
Definition at line 69 of file generic_timer.hh.
Referenced by SystemCounter().
|
protected |
Cached copy of the counter period (inverse of the frequency).
Definition at line 71 of file generic_timer.hh.
Referenced by period(), serialize(), setFreq(), SystemCounter(), unserialize(), and value().
|
protected |
Hypervisor event stream control register.
Definition at line 78 of file generic_timer.hh.
Referenced by getHypControl(), serialize(), and unserialize().
|
protected |
Kernel event stream control register.
Definition at line 76 of file generic_timer.hh.
Referenced by getKernelControl(), serialize(), and unserialize().
|
protected |
Tick when the counter was reset.
Definition at line 73 of file generic_timer.hh.
Referenced by serialize(), setFreq(), and unserialize().
|
staticprotected |
Maximum architectural number of frequency table entries.
Definition at line 81 of file generic_timer.hh.
Referenced by SystemCounter().