sim: Add units to src/sim
authorHoa Nguyen <hoanguyen@ucdavis.edu>
Mon, 18 Jan 2021 12:38:57 +0000 (04:38 -0800)
committerHoa Nguyen <hoanguyen@ucdavis.edu>
Wed, 10 Feb 2021 09:03:09 +0000 (09:03 +0000)
Change-Id: I5fa147aa1319d62be1790bbd74fd097ac566f808
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39296
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>

src/sim/clock_domain.cc
src/sim/power/power_model.cc
src/sim/power/thermal_domain.cc
src/sim/power_domain.cc
src/sim/power_state.cc
src/sim/process.cc
src/sim/root.cc
src/sim/voltage_domain.cc
src/sim/workload.hh

index f27a8f3f155dea1a7a709239a6c1c5f3c9321f62..ed953e1bc735fb6b43b2e98e320ba9a63b642077 100644 (file)
@@ -53,7 +53,7 @@
 
 ClockDomain::ClockDomainStats::ClockDomainStats(ClockDomain &cd)
     : Stats::Group(&cd),
-    ADD_STAT(clock, "Clock period in ticks")
+    ADD_STAT(clock, UNIT_TICK, "Clock period in ticks")
 {
     // Expose the current clock period as a stat for observability in
     // the dumps
index e79ecbcd0a701a54980062fc5d1ad98693d8af19..d62de3a2b0964130b25b95e9c9b4bcc14900f6c0 100644 (file)
@@ -45,8 +45,9 @@
 
 PowerModelState::PowerModelState(const Params &p)
     : SimObject(p), _temp(0), clocked_object(NULL),
-      ADD_STAT(dynamicPower, "Dynamic power for this object (Watts)"),
-      ADD_STAT(staticPower, "Static power for this object (Watts)")
+      ADD_STAT(dynamicPower, UNIT_WATT,
+               "Dynamic power for this object (Watts)"),
+      ADD_STAT(staticPower, UNIT_WATT, "Static power for this object (Watts)")
 {
     dynamicPower
       .method(this, &PowerModelState::getDynamicPower);
@@ -57,8 +58,10 @@ PowerModelState::PowerModelState(const Params &p)
 PowerModel::PowerModel(const Params &p)
     : SimObject(p), states_pm(p.pm), subsystem(p.subsystem),
       clocked_object(NULL), power_model_type(p.pm_type),
-      ADD_STAT(dynamicPower, "Dynamic power for this power state"),
-      ADD_STAT(staticPower, "Static power for this power state")
+      ADD_STAT(dynamicPower, UNIT_WATT,
+                         "Dynamic power for this power state"),
+      ADD_STAT(staticPower, UNIT_WATT,
+                         "Static power for this power state")
 {
     panic_if(subsystem == NULL,
              "Subsystem is NULL! This is not acceptable for a PowerModel!\n");
index 2d9076ba4f48d39712824acfb6c2f99219ecb959..fff5dfe7bcc0c9a8ad1761e6d485c24eaf5fae62 100644 (file)
@@ -51,7 +51,7 @@
 ThermalDomain::ThermalDomain(const Params &p)
     : SimObject(p), _initTemperature(p.initial_temperature),
     node(NULL), subsystem(NULL),
-    ADD_STAT(currentTemp, "Temperature in centigrade degrees")
+    ADD_STAT(currentTemp, UNIT_CELSIUS, "Temperature")
 {
     currentTemp
         .functor([this]() { return currentTemperature().toCelsius(); });
index c6e0d35108b0915f29cb82d426639e7371bfddac..555d88dca13de224fec652c6dc653731acaf830a 100644 (file)
@@ -243,11 +243,11 @@ PowerDomain::pwrStateChangeCallback(Enums::PwrState new_pwr_state,
 
 PowerDomain::PowerDomainStats::PowerDomainStats(PowerDomain &pd)
     : Stats::Group(&pd),
-    ADD_STAT(numLeaderCalls,
+    ADD_STAT(numLeaderCalls, UNIT_COUNT,
              "Number of calls by leaders to change power domain state"),
-    ADD_STAT(numLeaderCallsChangingState,
-             "Number of calls by leader to change power domain state "
-             "actually resulting in a power state change")
+    ADD_STAT(numLeaderCallsChangingState, UNIT_COUNT,
+             "Number of calls by leader to change power domain state actually "
+             "resulting in a power state change")
 {
 }
 
index ffa19721ad69689776ec2a341eced892d68d97fa..a12e2477079c93fc66000271439362ab87f06a5c 100644 (file)
@@ -220,13 +220,12 @@ PowerState::getWeights() const
 PowerState::PowerStateStats::PowerStateStats(PowerState &co)
     : Stats::Group(&co),
     powerState(co),
-    ADD_STAT(numTransitions,
-             "Number of power state transitions"),
-    ADD_STAT(numPwrMatchStateTransitions,
+    ADD_STAT(numTransitions, UNIT_COUNT, "Number of power state transitions"),
+    ADD_STAT(numPwrMatchStateTransitions, UNIT_COUNT,
              "Number of power state transitions due match request"),
-    ADD_STAT(ticksClkGated,
+    ADD_STAT(ticksClkGated, UNIT_TICK,
              "Distribution of time spent in the clock gated state"),
-    ADD_STAT(pwrStateResidencyTicks,
+    ADD_STAT(pwrStateResidencyTicks, UNIT_TICK,
              "Cumulative time (in ticks) in various power states")
 {
 }
index 21d4c2ad282cb6d6eb8253dc59e48403e44a71bd..9df1458c2624b53f301b19c3134b0141957749ce 100644 (file)
@@ -127,7 +127,7 @@ Process::Process(const ProcessParams &params, EmulationPageTable *pTable,
       fds(std::make_shared<FDArray>(
                   params.input, params.output, params.errout)),
       childClearTID(0),
-      ADD_STAT(numSyscalls, "Number of system calls")
+      ADD_STAT(numSyscalls, UNIT_COUNT, "Number of system calls")
 {
     if (_pid >= System::maxPID)
         fatal("_pid is too large: %d", _pid);
index 4927940a3d04578c72ea10b9e7a88268c27f8381..57212b266769f7695114cba4df8464e0c827754d 100644 (file)
@@ -54,14 +54,18 @@ Root::RootStats &rootStats = Root::RootStats::instance;
 
 Root::RootStats::RootStats()
     : Stats::Group(nullptr),
-    ADD_STAT(simSeconds, "Number of seconds simulated"),
-    ADD_STAT(simTicks, "Number of ticks simulated"),
-    ADD_STAT(finalTick, "Number of ticks from beginning of simulation "
-                        "(restored from checkpoints and never reset)"),
-    ADD_STAT(simFreq, "Frequency of simulated ticks"),
-    ADD_STAT(hostSeconds, "Real time elapsed on the host"),
-    ADD_STAT(hostTickRate, "Simulator tick rate (ticks/s)"),
-    ADD_STAT(hostMemory, "Number of bytes of host memory used"),
+    ADD_STAT(simSeconds, UNIT_SECOND, "Number of seconds simulated"),
+    ADD_STAT(simTicks, UNIT_TICK, "Number of ticks simulated"),
+    ADD_STAT(finalTick, UNIT_TICK,
+             "Number of ticks from beginning of simulation "
+             "(restored from checkpoints and never reset)"),
+    ADD_STAT(simFreq, UNIT_RATE(Stats::Units::Tick, Stats::Units::Second),
+             "The number of ticks per simulated second"),
+    ADD_STAT(hostSeconds, UNIT_SECOND, "Real time elapsed on the host"),
+    ADD_STAT(hostTickRate,
+             UNIT_RATE(Stats::Units::Tick, Stats::Units::Second),
+             "The number of ticks simulated per host second (ticks/s)"),
+    ADD_STAT(hostMemory, UNIT_BYTE, "Number of bytes of host memory used"),
 
     statTime(true),
     startTick(0)
index d770af852107f0eec27b7f4545936c66546b9ca8..714bb93046da6af9c308380b6cd6b741616a80f6 100644 (file)
@@ -139,7 +139,7 @@ VoltageDomain::unserialize(CheckpointIn &cp)
 
 VoltageDomain::VoltageDomainStats::VoltageDomainStats(VoltageDomain &vd)
     : Stats::Group(&vd),
-    ADD_STAT(voltage, "Voltage in Volts")
+    ADD_STAT(voltage, UNIT_VOLT, "Voltage in Volts")
 {
     voltage.method(&vd, &VoltageDomain::voltage);
 }
index f7d3b0616cc4b9ff6aa1bc0047876f6240863072..58464696b668318ed83329d678f775d118ff26ae 100644 (file)
@@ -50,8 +50,10 @@ class Workload : public SimObject
             Stats::Scalar quiesce;
 
             InstStats(Stats::Group *parent) : Stats::Group(parent, "inst"),
-                ADD_STAT(arm, "number of arm instructions executed"),
-                ADD_STAT(quiesce, "number of quiesce instructions executed")
+                ADD_STAT(arm, UNIT_COUNT,
+                         "number of arm instructions executed"),
+                ADD_STAT(quiesce, UNIT_COUNT,
+                         "number of quiesce instructions executed")
             {}
 
         } instStats;