changeset 9d6d630f830e in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=9d6d630f830e
description:
        sim: Expose the current clock period as a stat

        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.

diffstat:

 src/sim/clock_domain.cc |  14 ++++++++++++++
 src/sim/clock_domain.hh |   9 +++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diffs (50 lines):

diff -r 2f33cb012383 -r 9d6d630f830e src/sim/clock_domain.cc
--- a/src/sim/clock_domain.cc   Fri Jan 24 15:29:30 2014 -0600
+++ b/src/sim/clock_domain.cc   Fri Jan 24 15:29:30 2014 -0600
@@ -49,6 +49,20 @@
 #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
 {
diff -r 2f33cb012383 -r 9d6d630f830e src/sim/clock_domain.hh
--- a/src/sim/clock_domain.hh   Fri Jan 24 15:29:30 2014 -0600
+++ b/src/sim/clock_domain.hh   Fri Jan 24 15:29:30 2014 -0600
@@ -72,6 +72,13 @@
 class ClockDomain : public SimObject
 {
 
+  private:
+
+    /**
+     * Stat to report clock period of clock domain
+     */
+    Stats::Value currentClock;
+
   protected:
 
     /**
@@ -105,6 +112,8 @@
         _clockPeriod(0),
         _voltageDomain(voltage_domain) {}
 
+    void regStats();
+
     /**
      * Get the clock period.
      *
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to