41 #ifndef __ARCH_ARM_PMU_HH__
42 #define __ARCH_ARM_PMU_HH__
93 PMU(
const ArmPMUParams *
p);
174 typedef
unsigned int CounterId;
270 pmu(_pmu), id(_id) {}
272 void notify(
const uint64_t &val)
override
296 : obj(_obj), name(_name) {}
305 std::unique_ptr<ProbeListener>
create(
PMU &pmu, CounterId cid)
const
307 std::unique_ptr<ProbeListener> ptr;
341 bool add(uint64_t delta);
433 bool isFiltered(
const CounterState &ctr)
const;
const unsigned int pmuInterrupt
Performance monitor interrupt number.
void updateAllCounters()
Call updateCounter() for each counter in the PMU if the counter's state has changed.
void drainResume() override
Resume execution after a successful drain.
void handleEvent(CounterId id, uint64_t delta)
Handle an counting event triggered by a probe.
unsigned clock_remainder
Remainder part when the clock counter is divided by 64.
uint64_t getCounterValue(CounterId id) const
Get the value of a performance counter.
std::unique_ptr< ProbeListener > create(PMU &pmu, CounterId cid) const
Create and attach a probe used to drive this event.
CounterState & getCounter(CounterId id)
Return the state of a counter.
void addEventProbe(unsigned int id, SimObject *obj, const char *name)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Model of an ARM PMU version 3.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool isFiltered(const CounterState &ctr) const
Check if a counter's settings allow it to be counted.
PMSELR_t reg_pmselr
Performance Monitor Selection Register.
PMCR_t reg_pmcr
Performance Monitor Control Register.
Base class for devices that use the MiscReg interfaces.
const CounterState & getCounter(CounterId id) const
Return the state of a counter.
CounterState cycleCounter
State of the cycle counter.
ProbeManager is a conduit class that lives on each SimObject, and is used to match up probe listeners...
ProbeListener(PMU &_pmu, CounterId _id, ProbeManager *pm, const std::string &name)
Bitfield< 23, 16 > idcode
ThreadContext is the external interface to all thread state for anything outside of the CPU...
MiscReg readMiscReg(int misc_reg) override
Read a register within the PMU.
MiscReg reg_pmovsr
Performance Monitor Overflow Status Register.
MiscReg readMiscRegInt(int misc_reg)
MiscReg reg_pminten
Performance Monitor Interrupt Enable Register.
std::vector< CounterState > counters
State of all general-purpose counters supported by PMU.
SimObject *const obj
SimObject being measured by this probe.
bool isValidCounter(CounterId id) const
Is this a valid counter ID?
Platform *const platform
Platform this device belongs to.
ProbeListenerArgBase is used to define the base interface to a ProbeListenerArg (i.e the notify method on specific type).
void notify(const uint64_t &val) override
void raiseInterrupt()
Deliver a PMU interrupt to the GIC.
uint64_t reg_pmceid
Performance counter ID register.
Event type configuration.
void setControlReg(PMCR_t val)
PMCR write handling.
MiscReg reg_pmcnten
Performance Monitor Count Enable Register.
void resetEventCounts()
Reset all event counters excluding the cycle counter to zero.
BitUnion32(PMCR_t) Bitfield< 0 > e
EventType(SimObject *_obj, const std::string &_name)
static const MiscReg reg_pmcr_wr_mask
PMCR write mask when accessed from the guest.
Basic support for object serialization.
PMEVTYPER_t filter
Filtering settings (evtCount is unused)
void setCounterValue(CounterId id, uint64_t val)
Set the value of a performance counter.
PMCR_t reg_pmcr_conf
Constant (configuration-dependent) part of the PMCR.
PMU(const ArmPMUParams *p)
bool add(uint64_t delta)
Add an event count to the counter and check for overflow.
virtual const std::string name() const
void updateCounter(CounterId id, CounterState &ctr)
Depending on counter configuration, add or remove the probes driving the counter. ...
std::unique_ptr< ProbeListener > ProbeListenerUPtr
std::ostream CheckpointOut
const std::string name
Probe name within obj.
void setMiscReg(int misc_reg, MiscReg val) override
Set a register within the PMU.
bool overflow64
Is this a 64-bit counter?
ProbeManager * getProbeManager()
Get the probe manager for this object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
static const CounterId PMCCNTR
Cycle Count Register Number.
unsigned int EventTypeId
Event type ID.
void setCounterTypeRegister(CounterId id, PMEVTYPER_t type)
Set the type and filter settings of a performance counter (PMEVTYPER)
std::vector< ProbeListenerUPtr > listeners
Probe listeners driving this counter.
PMEVTYPER_t getCounterTypeRegister(CounterId id) const
Get the type and filter settings of a counter (PMEVTYPER)
std::multimap< EventTypeId, EventType > pmuEventTypes
Event types supported by this PMU.
EventTypeId eventId
Counter event ID.
static const EventTypeId ARCH_EVENT_SW_INCR
ID of the software increment event.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Abstract superclass for simulation objects.
State of a counter within the PMU.
EndBitUnion(PMCR_t) BitUnion32(PMSELR_t) Bitfield<4
uint64_t value
Current value of the counter.
bool enabled
Is the counter enabled?