sim: Expose the current voltage for each object as a stat

This commit is contained in:
Andreas Hansson
2014-01-24 15:29:30 -06:00
parent 1d85e914a6
commit 4de69821e6
2 changed files with 19 additions and 0 deletions

View 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()
{

View 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