changeset 1dc178e53487 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=1dc178e53487
description:
        stats: fix duplicate statistics names.
        This generally requires providing a more meaningful name() function for 
a
        class.

diffstat:

4 files changed, 29 insertions(+), 25 deletions(-)
src/cpu/o3/bpred_unit.hh        |    4 ++++
src/cpu/o3/bpred_unit_impl.hh   |   23 ++++++++++++-----------
src/cpu/o3/mem_dep_unit.hh      |    8 ++++++--
src/cpu/o3/mem_dep_unit_impl.hh |   19 +++++++------------

diffs (172 lines):

diff -r 97660425ff39 -r 1dc178e53487 src/cpu/o3/bpred_unit.hh
--- a/src/cpu/o3/bpred_unit.hh  Sat Mar 07 14:30:53 2009 -0800
+++ b/src/cpu/o3/bpred_unit.hh  Sat Mar 07 14:30:54 2009 -0800
@@ -62,6 +62,8 @@
 
     PredType predictor;
 
+    const std::string _name;
+
   public:
 
     /**
@@ -69,6 +71,8 @@
      */
     BPredUnit(DerivO3CPUParams *params);
 
+    const std::string &name() const { return _name; }
+
     /**
      * Registers statistics.
      */
diff -r 97660425ff39 -r 1dc178e53487 src/cpu/o3/bpred_unit_impl.hh
--- a/src/cpu/o3/bpred_unit_impl.hh     Sat Mar 07 14:30:53 2009 -0800
+++ b/src/cpu/o3/bpred_unit_impl.hh     Sat Mar 07 14:30:54 2009 -0800
@@ -38,9 +38,10 @@
 
 template<class Impl>
 BPredUnit<Impl>::BPredUnit(DerivO3CPUParams *params)
-  : BTB(params->BTBEntries,
-        params->BTBTagSize,
-        params->instShiftAmt)
+    : _name(params->name + ".BPredUnit"),
+      BTB(params->BTBEntries,
+          params->BTBTagSize,
+          params->instShiftAmt)
 {
     // Setup the selected predictor.
     if (params->predType == "local") {
@@ -73,43 +74,43 @@
 BPredUnit<Impl>::regStats()
 {
     lookups
-        .name(name() + ".BPredUnit.lookups")
+        .name(name() + ".lookups")
         .desc("Number of BP lookups")
         ;
 
     condPredicted
-        .name(name() + ".BPredUnit.condPredicted")
+        .name(name() + ".condPredicted")
         .desc("Number of conditional branches predicted")
         ;
 
     condIncorrect
-        .name(name() + ".BPredUnit.condIncorrect")
+        .name(name() + ".condIncorrect")
         .desc("Number of conditional branches incorrect")
         ;
 
     BTBLookups
-        .name(name() + ".BPredUnit.BTBLookups")
+        .name(name() + ".BTBLookups")
         .desc("Number of BTB lookups")
         ;
 
     BTBHits
-        .name(name() + ".BPredUnit.BTBHits")
+        .name(name() + ".BTBHits")
         .desc("Number of BTB hits")
         ;
 
     BTBCorrect
-        .name(name() + ".BPredUnit.BTBCorrect")
+        .name(name() + ".BTBCorrect")
         .desc("Number of correct BTB predictions (this stat may not "
               "work properly.")
         ;
 
     usedRAS
-        .name(name() + ".BPredUnit.usedRAS")
+        .name(name() + ".usedRAS")
         .desc("Number of times the RAS was used to get a target.")
         ;
 
     RASIncorrect
-        .name(name() + ".BPredUnit.RASInCorrect")
+        .name(name() + ".RASInCorrect")
         .desc("Number of incorrect RAS predictions.")
         ;
 }
diff -r 97660425ff39 -r 1dc178e53487 src/cpu/o3/mem_dep_unit.hh
--- a/src/cpu/o3/mem_dep_unit.hh        Sat Mar 07 14:30:53 2009 -0800
+++ b/src/cpu/o3/mem_dep_unit.hh        Sat Mar 07 14:30:54 2009 -0800
@@ -65,7 +65,11 @@
  * dependence prediction schemes.
  */
 template <class MemDepPred, class Impl>
-class MemDepUnit {
+class MemDepUnit
+{
+  protected:
+    std::string _name;
+
   public:
     typedef typename Impl::DynInstPtr DynInstPtr;
 
@@ -79,7 +83,7 @@
     ~MemDepUnit();
 
     /** Returns the name of the memory dependence unit. */
-    std::string name() const;
+    std::string name() const { return _name; }
 
     /** Initializes the unit with parameters and a thread id. */
     void init(DerivO3CPUParams *params, int tid);
diff -r 97660425ff39 -r 1dc178e53487 src/cpu/o3/mem_dep_unit_impl.hh
--- a/src/cpu/o3/mem_dep_unit_impl.hh   Sat Mar 07 14:30:53 2009 -0800
+++ b/src/cpu/o3/mem_dep_unit_impl.hh   Sat Mar 07 14:30:54 2009 -0800
@@ -44,7 +44,8 @@
 
 template <class MemDepPred, class Impl>
 MemDepUnit<MemDepPred, Impl>::MemDepUnit(DerivO3CPUParams *params)
-    : depPred(params->SSITSize, params->LFSTSize), loadBarrier(false),
+    : _name(params->name + ".memdepunit"),
+      depPred(params->SSITSize, params->LFSTSize), loadBarrier(false),
       loadBarrierSN(0), storeBarrier(false), storeBarrierSN(0), iqPtr(NULL)
 {
     DPRINTF(MemDepUnit, "Creating MemDepUnit object.\n");
@@ -76,18 +77,12 @@
 }
 
 template <class MemDepPred, class Impl>
-std::string
-MemDepUnit<MemDepPred, Impl>::name() const
-{
-    return "memdepunit";
-}
-
-template <class MemDepPred, class Impl>
 void
 MemDepUnit<MemDepPred, Impl>::init(DerivO3CPUParams *params, int tid)
 {
     DPRINTF(MemDepUnit, "Creating MemDepUnit %i object.\n",tid);
 
+    _name = csprintf("%s.memDep%d", params->name, tid);
     id = tid;
 
     depPred.init(params->SSITSize, params->LFSTSize);
@@ -98,19 +93,19 @@
 MemDepUnit<MemDepPred, Impl>::regStats()
 {
     insertedLoads
-        .name(name() + ".memDep.insertedLoads")
+        .name(name() + ".insertedLoads")
         .desc("Number of loads inserted to the mem dependence unit.");
 
     insertedStores
-        .name(name() + ".memDep.insertedStores")
+        .name(name() + ".insertedStores")
         .desc("Number of stores inserted to the mem dependence unit.");
 
     conflictingLoads
-        .name(name() + ".memDep.conflictingLoads")
+        .name(name() + ".conflictingLoads")
         .desc("Number of conflicting loads.");
 
     conflictingStores
-        .name(name() + ".memDep.conflictingStores")
+        .name(name() + ".conflictingStores")
         .desc("Number of conflicting stores.");
 }
 
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to