From: Andreas Hansson Date: Fri, 24 Jan 2014 21:29:30 +0000 (-0600) Subject: sim: Expose the current voltage for each object as a stat X-Git-Tag: stable_2014_08_26~209 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4de69821e630576f40c55a26355ed1064c6a233c;p=gem5.git sim: Expose the current voltage for each object as a stat --- 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