sim: Expose the current clock period as a stat
authorAndreas Hansson <andreas.hansson@arm.com>
Fri, 24 Jan 2014 21:29:30 +0000 (15:29 -0600)
committerAndreas Hansson <andreas.hansson@arm.com>
Fri, 24 Jan 2014 21:29:30 +0000 (15:29 -0600)
This patch adds observability to the clock period of the clock domains
by including it as a stat.

As a result of adding this, the regressions will be updated in a
separate patch.

src/sim/clock_domain.cc
src/sim/clock_domain.hh

index ff96f280892fffa240c5d105224ce8342b730593..0d1836e83c00c1070d5f1799ce8c73eafdf44f3b 100644 (file)
 #include "sim/voltage_domain.hh"
 #include "sim/clocked_object.hh"
 
+void
+ClockDomain::regStats()
+{
+    using namespace Stats;
+
+    // Expose the current clock period as a stat for observability in
+    // the dumps
+    currentClock
+        .scalar(_clockPeriod)
+        .name(params()->name + ".clock")
+        .desc("Clock period in ticks")
+        ;
+}
+
 double
 ClockDomain::voltage() const
 {
index e6b7273c1f297ad937472ffa512da49e8b51e7fb..b597b6611bff5ef5c41dcb71d070bc87e14cf303 100644 (file)
@@ -72,6 +72,13 @@ class ClockedObject;
 class ClockDomain : public SimObject
 {
 
+  private:
+
+    /**
+     * Stat to report clock period of clock domain
+     */
+    Stats::Value currentClock;
+
   protected:
 
     /**
@@ -105,6 +112,8 @@ class ClockDomain : public SimObject
         _clockPeriod(0),
         _voltageDomain(voltage_domain) {}
 
+    void regStats();
+
     /**
      * Get the clock period.
      *