gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
SystemCounter Class Reference

Global system counter. More...

#include <generic_timer.hh>

Inheritance diagram for SystemCounter:
Serializable

Public Member Functions

 SystemCounter ()
 
uint64_t value () const
 Returns the current value of the physical counter. More...
 
uint64_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 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

uint64_t _freq
 Counter frequency (as specified by CNTFRQ). 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
 

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
 

Detailed Description

Global system counter.

It is shared by the architected timers.

Todo:
: implement memory-mapped controls

Definition at line 61 of file generic_timer.hh.

Constructor & Destructor Documentation

SystemCounter::SystemCounter ( )

Definition at line 50 of file generic_timer.cc.

References setFreq().

SystemCounter::SystemCounter ( const SystemCounter c)
private

Member Function Documentation

uint64_t SystemCounter::freq ( ) const
inline

Returns the counter frequency.

Definition at line 85 of file generic_timer.hh.

References _freq.

Referenced by GenericTimerMem::ctrlRead(), GenericTimer::readMiscReg(), setFreq(), and GenericTimerMem::timerRead().

uint32_t SystemCounter::getKernelControl ( )
inline

Definition at line 94 of file generic_timer.hh.

References _regCntkctl.

Referenced by GenericTimer::readMiscReg().

Tick SystemCounter::period ( ) const
inline

Returns the counter period.

Definition at line 91 of file generic_timer.hh.

References _period.

Referenced by ArchTimer::updateCounter().

void SystemCounter::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 69 of file generic_timer.cc.

References _freq, _period, _regCntkctl, _resetTick, and SERIALIZE_SCALAR.

void SystemCounter::setFreq ( uint32_t  freq)

Sets the counter frequency.

Parameters
freqfrequency in Hz.

Definition at line 57 of file generic_timer.cc.

References _freq, _period, _resetTick, curTick(), freq(), SimClock::Frequency, and warn_once.

Referenced by GenericTimer::setMiscReg(), and SystemCounter().

void SystemCounter::setKernelControl ( uint32_t  val)
inline

Definition at line 93 of file generic_timer.hh.

References _regCntkctl, and X86ISA::val.

Referenced by GenericTimer::setMiscReg().

void SystemCounter::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 78 of file generic_timer.cc.

References _freq, _period, _regCntkctl, _resetTick, UNSERIALIZE_OPT_SCALAR, and UNSERIALIZE_SCALAR.

uint64_t SystemCounter::value ( ) const
inline

Returns the current value of the physical counter.

Definition at line 77 of file generic_timer.hh.

References _freq, _period, _resetTick, and curTick().

Referenced by ArchTimer::value().

Member Data Documentation

uint64_t SystemCounter::_freq
protected

Counter frequency (as specified by CNTFRQ).

Definition at line 65 of file generic_timer.hh.

Referenced by freq(), serialize(), setFreq(), unserialize(), and value().

Tick SystemCounter::_period
protected

Cached copy of the counter period (inverse of the frequency).

Definition at line 67 of file generic_timer.hh.

Referenced by period(), serialize(), setFreq(), unserialize(), and value().

uint32_t SystemCounter::_regCntkctl
protected

Definition at line 71 of file generic_timer.hh.

Referenced by getKernelControl(), serialize(), setKernelControl(), and unserialize().

Tick SystemCounter::_resetTick
protected

Tick when the counter was reset.

Definition at line 69 of file generic_timer.hh.

Referenced by serialize(), setFreq(), unserialize(), and value().


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

Generated on Fri Jun 9 2017 13:04:20 for gem5 by doxygen 1.8.6