diff --git a/src/sim/clock_domain.cc b/src/sim/clock_domain.cc index ff96f28089..0d1836e83c 100644 --- a/src/sim/clock_domain.cc +++ b/src/sim/clock_domain.cc @@ -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 --git a/src/sim/clock_domain.hh b/src/sim/clock_domain.hh index e6b7273c1f..b597b6611b 100644 --- a/src/sim/clock_domain.hh +++ b/src/sim/clock_domain.hh @@ -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. *