From: Hoa Nguyen Date: Mon, 18 Jan 2021 12:38:57 +0000 (-0800) Subject: sim: Add units to src/sim X-Git-Tag: develop-gem5-snapshot~116 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eade85fa50245a54ffa96f55d65cc6438c95681b;p=gem5.git sim: Add units to src/sim Change-Id: I5fa147aa1319d62be1790bbd74fd097ac566f808 Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39296 Tested-by: kokoro Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce --- diff --git a/src/sim/clock_domain.cc b/src/sim/clock_domain.cc index f27a8f3f1..ed953e1bc 100644 --- a/src/sim/clock_domain.cc +++ b/src/sim/clock_domain.cc @@ -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 diff --git a/src/sim/power/power_model.cc b/src/sim/power/power_model.cc index e79ecbcd0..d62de3a2b 100644 --- a/src/sim/power/power_model.cc +++ b/src/sim/power/power_model.cc @@ -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"); diff --git a/src/sim/power/thermal_domain.cc b/src/sim/power/thermal_domain.cc index 2d9076ba4..fff5dfe7b 100644 --- a/src/sim/power/thermal_domain.cc +++ b/src/sim/power/thermal_domain.cc @@ -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(); }); diff --git a/src/sim/power_domain.cc b/src/sim/power_domain.cc index c6e0d3510..555d88dca 100644 --- a/src/sim/power_domain.cc +++ b/src/sim/power_domain.cc @@ -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") { } diff --git a/src/sim/power_state.cc b/src/sim/power_state.cc index ffa19721a..a12e24770 100644 --- a/src/sim/power_state.cc +++ b/src/sim/power_state.cc @@ -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") { } diff --git a/src/sim/process.cc b/src/sim/process.cc index 21d4c2ad2..9df1458c2 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -127,7 +127,7 @@ Process::Process(const ProcessParams ¶ms, EmulationPageTable *pTable, fds(std::make_shared( 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); diff --git a/src/sim/root.cc b/src/sim/root.cc index 4927940a3..57212b266 100644 --- a/src/sim/root.cc +++ b/src/sim/root.cc @@ -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) diff --git a/src/sim/voltage_domain.cc b/src/sim/voltage_domain.cc index d770af852..714bb9304 100644 --- a/src/sim/voltage_domain.cc +++ b/src/sim/voltage_domain.cc @@ -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); } diff --git a/src/sim/workload.hh b/src/sim/workload.hh index f7d3b0616..58464696b 100644 --- a/src/sim/workload.hh +++ b/src/sim/workload.hh @@ -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;