summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sim/voltage_domain.cc12
-rw-r--r--src/sim/voltage_domain.hh7
2 files changed, 19 insertions, 0 deletions
diff --git a/src/sim/voltage_domain.cc b/src/sim/voltage_domain.cc
index 43848d68a..461e672ea 100644
--- a/src/sim/voltage_domain.cc
+++ b/src/sim/voltage_domain.cc
@@ -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()
{
diff --git a/src/sim/voltage_domain.hh b/src/sim/voltage_domain.hh
index 585ec8d66..b2f6715cf 100644
--- a/src/sim/voltage_domain.hh
+++ b/src/sim/voltage_domain.hh
@@ -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