gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
gem5::ArmISA::PMU::CounterState Struct Reference

State of a counter within the PMU. More...

#include <pmu.hh>

Inheritance diagram for gem5::ArmISA::PMU::CounterState:
gem5::Serializable

Public Member Functions

 CounterState (PMU &pmuReference, uint64_t counter_id, const bool is_64_bit)
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
uint64_t add (uint64_t delta)
 Add an event count to the counter and check for overflow.
 
bool isFiltered () const
 
void detach ()
 Detach the counter from its event.
 
void attach (const std::shared_ptr< PMUEvent > &event)
 Attach this counter to an event.
 
uint64_t getCounterId () const
 Obtain the counter id.
 
uint64_t getValue () const
 rReturn the counter value
 
void setValue (uint64_t val)
 overwrite the value of the counter
 
- 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 Attributes

EventTypeId eventId
 Counter event ID.
 
PMEVTYPER_t filter
 Filtering settings (evtCount is unused)
 
bool enabled
 Is the counter enabled?
 
bool overflow64
 Is this a 64-bit counter?
 

Protected Member Functions

template<typename ... Args>
void debugCounter (const char *mainString, Args &...args) const
 

Protected Attributes

std::shared_ptr< PMUEventsourceEvent
 PmuEvent currently in use (if any)
 
uint64_t counterId
 id of the counter instance
 
uint64_t value
 Current value of the counter.
 
bool resetValue
 Flag keeping track if the counter has been reset.
 
PMUpmu
 

Additional Inherited Members

- 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.
 

Detailed Description

State of a counter within the PMU.

Definition at line 431 of file pmu.hh.

Constructor & Destructor Documentation

◆ CounterState()

gem5::ArmISA::PMU::CounterState::CounterState ( PMU & pmuReference,
uint64_t counter_id,
const bool is_64_bit )
inline

Member Function Documentation

◆ add()

uint64_t gem5::ArmISA::PMU::CounterState::add ( uint64_t delta)

Add an event count to the counter and check for overflow.

Parameters
deltaNumber of events to add to the counter.
Returns
the quantity remaining until a counter overflow occurs.

Definition at line 805 of file pmu.cc.

References counterId, gem5::ArmISA::PMU::isFiltered(), overflow64, pmu, resetValue, and value.

◆ attach()

void gem5::ArmISA::PMU::CounterState::attach ( const std::shared_ptr< PMUEvent > & event)

Attach this counter to an event.

Parameters
theevent to attach the counter to

Definition at line 565 of file pmu.cc.

References gem5::MipsISA::event, resetValue, sourceEvent, and value.

Referenced by gem5::ArmISA::PMU::updateCounter().

◆ debugCounter()

template<typename ... Args>
void gem5::ArmISA::PMU::CounterState::debugCounter ( const char * mainString,
Args &... args ) const
inlineprotected

Definition at line 517 of file pmu.hh.

References counterId, gem5::csprintf(), eventId, sourceEvent, and warn.

Referenced by getValue(), and setValue().

◆ detach()

void gem5::ArmISA::PMU::CounterState::detach ( )

Detach the counter from its event.

Definition at line 552 of file pmu.cc.

References counterId, DPRINTFS, eventId, pmu, and sourceEvent.

Referenced by gem5::ArmISA::PMU::updateCounter().

◆ getCounterId()

uint64_t gem5::ArmISA::PMU::CounterState::getCounterId ( ) const
inline

Obtain the counter id.

Returns
the pysical counter id

Definition at line 470 of file pmu.hh.

References counterId.

Referenced by gem5::ArmISA::PMU::updateCounter().

◆ getValue()

uint64_t gem5::ArmISA::PMU::CounterState::getValue ( ) const

rReturn the counter value

Returns
the counter value

Definition at line 576 of file pmu.cc.

References debugCounter(), sourceEvent, and value.

Referenced by gem5::ArmISA::PMU::getCounterValue().

◆ isFiltered()

bool gem5::ArmISA::PMU::CounterState::isFiltered ( ) const

◆ serialize()

void gem5::ArmISA::PMU::CounterState::serialize ( CheckpointOut & cp) const
overridevirtual

Serialize an object.

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

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 789 of file pmu.cc.

References eventId, overflow64, SERIALIZE_SCALAR, and value.

◆ setValue()

void gem5::ArmISA::PMU::CounterState::setValue ( uint64_t val)

overwrite the value of the counter

Parameters
thenew counter value

Definition at line 588 of file pmu.cc.

References debugCounter(), resetValue, sourceEvent, gem5::X86ISA::val, and value.

Referenced by gem5::ArmISA::PMU::setCounterValue().

◆ unserialize()

void gem5::ArmISA::PMU::CounterState::unserialize ( CheckpointIn & cp)
overridevirtual

Unserialize an object.

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

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 797 of file pmu.cc.

References eventId, overflow64, UNSERIALIZE_SCALAR, and value.

Member Data Documentation

◆ counterId

uint64_t gem5::ArmISA::PMU::CounterState::counterId
protected

id of the counter instance

Definition at line 506 of file pmu.hh.

Referenced by add(), CounterState(), debugCounter(), detach(), and getCounterId().

◆ enabled

bool gem5::ArmISA::PMU::CounterState::enabled

Is the counter enabled?

Definition at line 496 of file pmu.hh.

Referenced by CounterState(), gem5::ArmISA::PMU::updateAllCounters(), and gem5::ArmISA::PMU::updateCounter().

◆ eventId

◆ filter

PMEVTYPER_t gem5::ArmISA::PMU::CounterState::filter

Filtering settings (evtCount is unused)

Definition at line 493 of file pmu.hh.

Referenced by CounterState(), gem5::ArmISA::PMU::getCounterTypeRegister(), isFiltered(), and gem5::ArmISA::PMU::setCounterTypeRegister().

◆ overflow64

bool gem5::ArmISA::PMU::CounterState::overflow64

Is this a 64-bit counter?

Definition at line 499 of file pmu.hh.

Referenced by add(), CounterState(), serialize(), and unserialize().

◆ pmu

PMU& gem5::ArmISA::PMU::CounterState::pmu
protected

Definition at line 514 of file pmu.hh.

Referenced by add(), CounterState(), detach(), and isFiltered().

◆ resetValue

bool gem5::ArmISA::PMU::CounterState::resetValue
protected

Flag keeping track if the counter has been reset.

Definition at line 512 of file pmu.hh.

Referenced by add(), attach(), CounterState(), and setValue().

◆ sourceEvent

std::shared_ptr<PMUEvent> gem5::ArmISA::PMU::CounterState::sourceEvent
protected

PmuEvent currently in use (if any)

Definition at line 503 of file pmu.hh.

Referenced by attach(), CounterState(), debugCounter(), detach(), getValue(), and setValue().

◆ value

uint64_t gem5::ArmISA::PMU::CounterState::value
protected

Current value of the counter.

Definition at line 509 of file pmu.hh.

Referenced by add(), attach(), CounterState(), getValue(), serialize(), setValue(), and unserialize().


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

Generated on Mon May 26 2025 09:19:28 for gem5 by doxygen 1.13.2