sim: Expose the current voltage for each object 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)
src/sim/voltage_domain.cc
src/sim/voltage_domain.hh

index 43848d68af3171a1d5dda2aba611c7554aee0f47..461e672eaff16c8bf23f8d9a5b46bbccb9ea2935 100644 (file)
@@ -61,6 +61,18 @@ VoltageDomain::voltage(double voltage)
             "Setting voltage to %f for domain %s\n", _voltage, name());
 }
 
+void
+VoltageDomain::regStats()
+{
+    using namespace Stats;
+
+    currentVoltage
+        .scalar(_voltage)
+        .name(params()->name + ".voltage")
+        .desc("Voltage in Volts")
+        ;
+}
+
 VoltageDomain *
 VoltageDomainParams::create()
 {
index 585ec8d6600c070f56c4f30125f0a8269b75b0d5..b2f6715cff5744e5a0719142c493c091fb14ed66 100644 (file)
@@ -60,6 +60,11 @@ class VoltageDomain : public SimObject
      */
     double _voltage;
 
+    /**
+     * Stat for reporting voltage of the domain
+     */
+    Stats::Value currentVoltage;
+
   public:
 
     typedef VoltageDomainParams Params;
@@ -79,6 +84,8 @@ class VoltageDomain : public SimObject
      */
     void voltage(double voltage);
 
+    void regStats();
+
 };
 
 #endif