sim: Expose the current voltage for each object as a stat
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user