41 #ifndef __ARCH_ARM_PMU_HH__ 42 #define __ARCH_ARM_PMU_HH__ 53 #include "debug/PMUVerbose.hh" 99 PMU(
const ArmPMUParams *
p);
186 typedef
unsigned int CounterId;
322 virtual void increment(
const uint64_t val);
327 virtual void enable() = 0;
352 panic_if(!
object,
"malformed probe-point" 353 " definition with name %s\n", name);
355 microArchitectureEventSet.emplace(
object, name);
364 parentEvent(parent) {}
368 void notify(
const uint64_t &val);
400 void write(uint64_t val);
414 : eventId(0), filter(0),
enabled(false),
415 overflow64(false), sourceEvent(nullptr),
416 counterId(counter_id), value(0), resetValue(false),
428 uint64_t add(uint64_t delta);
458 uint64_t getValue()
const;
465 void setValue(uint64_t val);
495 template <
typename ...Args>
498 std::string userString =
csprintf(mainString, args...);
500 warn(
"[counterId = %d, eventId = %d, sourceEvent = 0x%x] %s",
501 counterId, eventId, sourceEvent, userString.c_str());
RegVal reg_pminten
Performance Monitor Interrupt Enable Register.
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.
unsigned clock_remainder
Remainder part when the clock counter is divided by 64.
RegVal reg_pmcnten
Performance Monitor Count Enable Register.
void detachEvent(PMU::CounterState *user)
detach this event from a given counter
uint64_t reg_pmceid0
Performance counter ID register.
CounterState & getCounter(CounterId id)
Return the state of a counter.
void addEventProbe(unsigned int id, SimObject *obj, const char *name)
Model of an ARM PMU version 3.
std::map< EventTypeId, PMUEvent * > eventMap
List of event types supported by this PMU.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
RegVal readMiscRegInt(int misc_reg)
PMSELR_t reg_pmselr
Performance Monitor Selection Register.
void clearInterrupt()
Clear a PMU interrupt.
PMCR_t reg_pmcr
Performance Monitor Control Register.
Base class for devices that use the MiscReg interfaces.
bool isFiltered(const CounterState &ctr) const
Check if a counter's settings allow it to be counted.
CounterState cycleCounter
State of the cycle counter.
uint64_t getCounterValue(CounterId id) const
Get the value of a performance counter.
const uint64_t cycleCounterEventId
The id of the counter hardwired to the cpu cycle counter.
void disable() override
Disable the current event.
Event definition base class.
void regProbeListeners() override
Register probe listeners for this object.
void setThreadContext(ThreadContext *tc) override
PMUEvent * sourceEvent
PmuEvent currently in use (if any)
Bitfield< 23, 16 > idcode
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual void disable()=0
Disable the current event.
std::set< PMU::CounterState * > userCounters
set of counters using this event
uint64_t maximumCounterCount
The number of regular event counters.
void addSoftwareIncrementEvent(unsigned int id)
bool resetValue
Flag keeping track if the counter has been reset.
virtual void enable()=0
Enable the current event.
std::string csprintf(const char *format, const Args &...args)
std::vector< CounterState > counters
State of all general-purpose counters supported by PMU.
void setOverflowStatus(RegVal new_val)
Used for writing the Overflow Flag Status Register (SET/CLR)
void enable() override
Enable the current event.
ArmInterruptPin * interrupt
Performance monitor interrupt number.
ProbeListenerArgBase is used to define the base interface to a ProbeListenerArg (i.e the notify method on specific type).
void raiseInterrupt()
Deliver a PMU interrupt to the GIC.
void registerEvent(uint32_t id)
uint64_t getValue() const
rReturn the counter value
void setControlReg(PMCR_t val)
PMCR write handling.
virtual void increment(const uint64_t val)
notify an event increment of val units, all the attached counters' value is incremented by val units...
void resetEventCounts()
Reset all event counters excluding the cycle counter to zero.
BitUnion32(PMCR_t) Bitfield< 0 > e
virtual const std::string name() const
std::set< EventTypeEntry > microArchitectureEventSet
The set of events driving the event value.
void addMicroarchitectureProbe(SimObject *object, std::string name)
Basic support for object serialization.
EndBitUnion(PMCR_t) BitUnion32(PMSELR_t) Bitfield< 4
void updateCounter(CounterState &ctr)
Depending on counter configuration, add or remove the probes driving the counter. ...
PMEVTYPER_t filter
Filtering settings (evtCount is unused)
RegularProbe(RegularEvent *parent, SimObject *obj, std::string name)
virtual void updateAttachedCounters()
Method called immediately before a counter access in order for the associated event to update its sta...
void setCounterValue(CounterId id, uint64_t val)
Set the value of a performance counter.
bool isValidCounter(CounterId id) const
Is this a valid counter ID?
PMCR_t reg_pmcr_conf
Constant (configuration-dependent) part of the PMCR.
PMU(const ArmPMUParams *p)
void attachEvent(PMU::CounterState *user)
attach this event to a given counter
RegVal reg_pmovsr
Performance Monitor Overflow Status Register.
SWIncrementEvent * swIncrementEvent
The event that implements the software increment.
std::ostream CheckpointOut
bool overflow64
Is this a 64-bit counter?
PMUEvent * getEvent(uint64_t eventId)
Obtain the event of a given id.
void debugCounter(const char *mainString, Args &...args) const
RegularEvent * parentEvent
std::vector< std::unique_ptr< RegularProbe > > attachedProbePointList
Set of probe listeners tapping onto each of the input micro-arch events which compose this pmu event...
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.
CounterState(PMU &pmuReference, uint64_t counter_id)
unsigned int EventTypeId
Event type ID.
const CounterState & getCounter(CounterId id) const
Return the state of a counter.
void setCounterTypeRegister(CounterId id, PMEVTYPER_t type)
Set the type and filter settings of a performance counter (PMEVTYPER)
void setMiscReg(int misc_reg, RegVal val) override
Set a register within the PMU.
RegVal readMiscReg(int misc_reg) override
Read a register within the PMU.
EventTypeId eventId
Counter event ID.
uint64_t getCounterId() const
Obtain the counter id.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
PMEVTYPER_t getCounterTypeRegister(CounterId id) const
Get the type and filter settings of a counter (PMEVTYPER)
Generic representation of an Arm interrupt pin.
uint64_t counterId
id of the counter instance
static const RegVal reg_pmcr_wr_mask
PMCR write mask when accessed from the guest.
Abstract superclass for simulation objects.
std::pair< SimObject *, std::string > EventTypeEntry
State of a counter within the PMU.
uint64_t value
Current value of the counter.
bool enabled
Is the counter enabled?