From e0074324bacf500f9d0cc11ebc6e2f29bf3d8ba1 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Thu, 16 Oct 2014 05:49:41 -0400 Subject: cpu: Probe points for basic PMU stats This changeset adds probe points that can be used to implement PMU counters for CPU stats. The following probes are supported: * BaseCPU::ppCycles / Cycles * BaseCPU::ppRetiredInsts / RetiredInsts * BaseCPU::ppRetiredLoads / RetiredLoads * BaseCPU::ppRetiredStores / RetiredStores * BaseCPU::ppRetiredBranches RetiredBranches --- src/cpu/base.hh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'src/cpu/base.hh') diff --git a/src/cpu/base.hh b/src/cpu/base.hh index a124b4282..75c8f7263 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -62,6 +62,7 @@ #include "sim/eventq.hh" #include "sim/full_system.hh" #include "sim/insttracer.hh" +#include "sim/probe/pmu.hh" #include "sim/system.hh" struct BaseCPUParams; @@ -280,6 +281,8 @@ class BaseCPU : public MemObject virtual void startup(); virtual void regStats(); + void regProbePoints() M5_ATTR_OVERRIDE; + void registerThreadContexts(); /** @@ -437,6 +440,54 @@ class BaseCPU : public MemObject */ void scheduleLoadStop(ThreadID tid, Counter loads, const char *cause); + public: + /** + * @{ + * @name PMU Probe points. + */ + + /** + * Helper method to trigger PMU probes for a committed + * instruction. + * + * @param inst Instruction that just committed + */ + virtual void probeInstCommit(const StaticInstPtr &inst); + + /** + * Helper method to instantiate probe points belonging to this + * object. + * + * @param name Name of the probe point. + * @return A unique_ptr to the new probe point. + */ + ProbePoints::PMUUPtr pmuProbePoint(const char *name); + + /** CPU cycle counter */ + ProbePoints::PMUUPtr ppCycles; + + /** + * Instruction commit probe point. + * + * This probe point is triggered whenever one or more instructions + * are committed. It is normally triggered once for every + * instruction. However, CPU models committing bundles of + * instructions may call notify once for the entire bundle. + */ + ProbePoints::PMUUPtr ppRetiredInsts; + + /** Retired load instructions */ + ProbePoints::PMUUPtr ppRetiredLoads; + /** Retired store instructions */ + ProbePoints::PMUUPtr ppRetiredStores; + + /** Retired branches (any type) */ + ProbePoints::PMUUPtr ppRetiredBranches; + + /** @} */ + + + // Function tracing private: bool functionTracingEnabled; -- cgit v1.2.3