base-stats,misc: Rename Stats namespace as statistics

As part of recent decisions regarding namespace
naming conventions, all namespaces will be changed
to snake case.

::Stats became ::statistics.

"statistics" was chosen over "stats" to avoid generating
conflicts with the already existing variables (there are
way too many "stats" in the codebase), which would make
this patch even more disturbing for the users.

Change-Id: If877b12d7dac356f86e3b3d941bf7558a4fd8719
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45421
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2021-05-06 20:00:51 -03:00
committed by Daniel Carvalho
parent fa505f1c23
commit 98ac080ec4
228 changed files with 3078 additions and 2970 deletions

View File

@@ -52,8 +52,8 @@
#include "sim/voltage_domain.hh"
ClockDomain::ClockDomainStats::ClockDomainStats(ClockDomain &cd)
: Stats::Group(&cd),
ADD_STAT(clock, Stats::units::Tick::get(), "Clock period in ticks")
: statistics::Group(&cd),
ADD_STAT(clock, statistics::units::Tick::get(), "Clock period in ticks")
{
// Expose the current clock period as a stat for observability in
// the dumps

View File

@@ -140,14 +140,14 @@ class ClockDomain : public SimObject
{ children.push_back(clock_domain); }
private:
struct ClockDomainStats : public Stats::Group
struct ClockDomainStats : public statistics::Group
{
ClockDomainStats(ClockDomain &cd);
/**
* Stat to report clock period of clock domain
*/
Stats::Value clock;
statistics::Value clock;
} stats;
};

View File

@@ -156,8 +156,8 @@ DVFSHandler::UpdateEvent::updatePerfLevel()
{
// Perform explicit stats dump for power estimation before performance
// level migration
Stats::dump();
Stats::reset();
statistics::dump();
statistics::reset();
// Update the performance level in the clock domain
auto d = dvfsHandler->findDomain(domainIDToSet);

View File

@@ -50,7 +50,7 @@
class ThreadContext;
typedef const char *FaultName;
typedef Stats::Scalar FaultStat;
typedef statistics::Scalar FaultStat;
class FaultBase
{

View File

@@ -62,7 +62,7 @@ MathExprPowerModel::startup()
continue;
}
auto *info = Stats::resolve(var);
auto *info = statistics::resolve(var);
fatal_if(!info, "Failed to evaluate %s in expression:\n%s\n",
var, expr.toStr());
statsMap[var] = info;
@@ -82,7 +82,7 @@ MathExprPowerModel::eval(const MathExpr &expr) const
double
MathExprPowerModel::getStatValue(const std::string &name) const
{
using namespace Stats;
using namespace statistics;
// Automatic variables:
if (name == "temp") {

View File

@@ -44,7 +44,9 @@
#include "sim/mathexpr.hh"
#include "sim/power/power_model.hh"
namespace Stats {
GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
namespace statistics
{
class Info;
}
@@ -99,7 +101,7 @@ class MathExprPowerModel : public PowerModelState
MathExpr dyn_expr, st_expr;
// Map that contains relevant stats for this power model
std::unordered_map<std::string, const Stats::Info*> statsMap;
std::unordered_map<std::string, const statistics::Info*> statsMap;
};
#endif

View File

@@ -45,9 +45,9 @@
PowerModelState::PowerModelState(const Params &p)
: SimObject(p), _temp(0), clocked_object(NULL),
ADD_STAT(dynamicPower, Stats::units::Watt::get(),
ADD_STAT(dynamicPower, statistics::units::Watt::get(),
"Dynamic power for this object (Watts)"),
ADD_STAT(staticPower, Stats::units::Watt::get(),
ADD_STAT(staticPower, statistics::units::Watt::get(),
"Static power for this object (Watts)")
{
dynamicPower
@@ -59,9 +59,9 @@ 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, Stats::units::Watt::get(),
ADD_STAT(dynamicPower, statistics::units::Watt::get(),
"Dynamic power for this power state"),
ADD_STAT(staticPower, Stats::units::Watt::get(),
ADD_STAT(staticPower, statistics::units::Watt::get(),
"Static power for this power state")
{
panic_if(subsystem == NULL,

View File

@@ -92,7 +92,7 @@ class PowerModelState : public SimObject
/** The clocked object we belong to */
ClockedObject * clocked_object;
Stats::Value dynamicPower, staticPower;
statistics::Value dynamicPower, staticPower;
};
/**
@@ -161,7 +161,7 @@ class PowerModel : public SimObject
/** The type of power model - collects all power, static or dynamic only */
enums::PMType power_model_type;
Stats::Value dynamicPower, staticPower;
statistics::Value dynamicPower, staticPower;
};
#endif

View File

@@ -51,7 +51,7 @@
ThermalDomain::ThermalDomain(const Params &p)
: SimObject(p), _initTemperature(p.initial_temperature),
node(NULL), subsystem(NULL),
ADD_STAT(currentTemp, Stats::units::DegreeCelsius::get(), "Temperature")
ADD_STAT(currentTemp, statistics::units::DegreeCelsius::get(), "Temperature")
{
currentTemp
.functor([this]() { return currentTemperature().toCelsius(); });

View File

@@ -100,7 +100,7 @@ class ThermalDomain : public SimObject, public ThermalEntity
SubSystem * subsystem;
/** Stat for reporting voltage of the domain */
Stats::Value currentTemp;
statistics::Value currentTemp;
/** Probe to signal for temperature changes in this domain */
ProbePointArg<Temperature> *ppThermalUpdate;

View File

@@ -242,10 +242,10 @@ PowerDomain::pwrStateChangeCallback(enums::PwrState new_pwr_state,
}
PowerDomain::PowerDomainStats::PowerDomainStats(PowerDomain &pd)
: Stats::Group(&pd),
ADD_STAT(numLeaderCalls, Stats::units::Count::get(),
: statistics::Group(&pd),
ADD_STAT(numLeaderCalls, statistics::units::Count::get(),
"Number of calls by leaders to change power domain state"),
ADD_STAT(numLeaderCallsChangingState, Stats::units::Count::get(),
ADD_STAT(numLeaderCallsChangingState, statistics::units::Count::get(),
"Number of calls by leader to change power domain state actually "
"resulting in a power state change")
{
@@ -254,12 +254,12 @@ PowerDomain::PowerDomainStats::PowerDomainStats(PowerDomain &pd)
void
PowerDomain::PowerDomainStats::regStats()
{
Stats::Group::regStats();
statistics::Group::regStats();
numLeaderCalls
.flags(Stats::nozero)
.flags(statistics::nozero)
;
numLeaderCallsChangingState
.flags(Stats::nozero)
.flags(statistics::nozero)
;
}

View File

@@ -152,14 +152,14 @@ class PowerDomain : public PowerState
pwrStateUpdateEvent;
protected:
struct PowerDomainStats : public Stats::Group
struct PowerDomainStats : public statistics::Group
{
PowerDomainStats(PowerDomain &pd);
void regStats() override;
Stats::Scalar numLeaderCalls;
Stats::Scalar numLeaderCallsChangingState;
statistics::Scalar numLeaderCalls;
statistics::Scalar numLeaderCallsChangingState;
} stats;
};

View File

@@ -202,7 +202,7 @@ PowerState::getWeights() const
{
// Get residency stats
std::vector<double> ret;
Stats::VCounter residencies;
statistics::VCounter residencies;
stats.pwrStateResidencyTicks.value(residencies);
// Account for current state too!
@@ -218,15 +218,15 @@ PowerState::getWeights() const
}
PowerState::PowerStateStats::PowerStateStats(PowerState &co)
: Stats::Group(&co),
: statistics::Group(&co),
powerState(co),
ADD_STAT(numTransitions, Stats::units::Count::get(),
ADD_STAT(numTransitions, statistics::units::Count::get(),
"Number of power state transitions"),
ADD_STAT(numPwrMatchStateTransitions, Stats::units::Count::get(),
ADD_STAT(numPwrMatchStateTransitions, statistics::units::Count::get(),
"Number of power state transitions due match request"),
ADD_STAT(ticksClkGated, Stats::units::Tick::get(),
ADD_STAT(ticksClkGated, statistics::units::Tick::get(),
"Distribution of time spent in the clock gated state"),
ADD_STAT(pwrStateResidencyTicks, Stats::units::Tick::get(),
ADD_STAT(pwrStateResidencyTicks, statistics::units::Tick::get(),
"Cumulative time (in ticks) in various power states")
{
}
@@ -234,9 +234,9 @@ PowerState::PowerStateStats::PowerStateStats(PowerState &co)
void
PowerState::PowerStateStats::regStats()
{
Stats::Group::regStats();
statistics::Group::regStats();
using namespace Stats;
using namespace statistics;
const PowerStateParams &p = powerState.params();
@@ -265,7 +265,7 @@ PowerState::PowerStateStats::regStats()
void
PowerState::PowerStateStats::preDumpStats()
{
Stats::Group::preDumpStats();
statistics::Group::preDumpStats();
/**
* For every stats dump, the power state residency and other distribution

View File

@@ -131,7 +131,7 @@ class PowerState : public SimObject
*/
PowerDomain* controlledDomain = nullptr;
struct PowerStateStats : public Stats::Group
struct PowerStateStats : public statistics::Group
{
PowerStateStats(PowerState &ps);
@@ -140,11 +140,11 @@ class PowerState : public SimObject
PowerState &powerState;
Stats::Scalar numTransitions;
Stats::Scalar numPwrMatchStateTransitions;
Stats::Distribution ticksClkGated;
statistics::Scalar numTransitions;
statistics::Scalar numPwrMatchStateTransitions;
statistics::Distribution ticksClkGated;
/** Tracks the time spent in each of the power states */
Stats::Vector pwrStateResidencyTicks;
statistics::Vector pwrStateResidencyTicks;
} stats;
};

View File

@@ -126,7 +126,7 @@ Process::Process(const ProcessParams &params, EmulationPageTable *pTable,
fds(std::make_shared<FDArray>(
params.input, params.output, params.errout)),
childClearTID(0),
ADD_STAT(numSyscalls, Stats::units::Count::get(),
ADD_STAT(numSyscalls, statistics::units::Count::get(),
"Number of system calls")
{
if (_pid >= System::maxPID)

View File

@@ -281,7 +281,8 @@ class Process : public SimObject
// Process was forked with SIGCHLD set.
bool *sigchld;
Stats::Scalar numSyscalls; // track how many system calls are executed
// Track how many system calls are executed
statistics::Scalar numSyscalls;
};
#endif // __PROCESS_HH__

View File

@@ -68,7 +68,7 @@
#include "sim/stats.hh"
#include "sim/system.hh"
using namespace Stats;
using namespace statistics;
GEM5_DEPRECATED_NAMESPACE(PseudoInst, pseudo_inst);
namespace pseudo_inst
@@ -307,7 +307,7 @@ resetstats(ThreadContext *tc, Tick delay, Tick period)
Tick when = curTick() + delay * sim_clock::as_int::ns;
Tick repeat = period * sim_clock::as_int::ns;
Stats::schedStatEvent(false, true, when, repeat);
statistics::schedStatEvent(false, true, when, repeat);
}
void
@@ -321,7 +321,7 @@ dumpstats(ThreadContext *tc, Tick delay, Tick period)
Tick when = curTick() + delay * sim_clock::as_int::ns;
Tick repeat = period * sim_clock::as_int::ns;
Stats::schedStatEvent(true, false, when, repeat);
statistics::schedStatEvent(true, false, when, repeat);
}
void
@@ -336,7 +336,7 @@ dumpresetstats(ThreadContext *tc, Tick delay, Tick period)
Tick when = curTick() + delay * sim_clock::as_int::ns;
Tick repeat = period * sim_clock::as_int::ns;
Stats::schedStatEvent(true, true, when, repeat);
statistics::schedStatEvent(true, true, when, repeat);
}
void

View File

@@ -53,23 +53,23 @@ Root::RootStats Root::RootStats::instance;
Root::RootStats &rootStats = Root::RootStats::instance;
Root::RootStats::RootStats()
: Stats::Group(nullptr),
ADD_STAT(simSeconds, Stats::units::Second::get(),
: statistics::Group(nullptr),
ADD_STAT(simSeconds, statistics::units::Second::get(),
"Number of seconds simulated"),
ADD_STAT(simTicks, Stats::units::Tick::get(),
ADD_STAT(simTicks, statistics::units::Tick::get(),
"Number of ticks simulated"),
ADD_STAT(finalTick, Stats::units::Tick::get(),
ADD_STAT(finalTick, statistics::units::Tick::get(),
"Number of ticks from beginning of simulation "
"(restored from checkpoints and never reset)"),
ADD_STAT(simFreq, Stats::units::Rate<
Stats::units::Tick, Stats::units::Second>::get(),
ADD_STAT(simFreq, statistics::units::Rate<
statistics::units::Tick, statistics::units::Second>::get(),
"The number of ticks per simulated second"),
ADD_STAT(hostSeconds, Stats::units::Second::get(),
ADD_STAT(hostSeconds, statistics::units::Second::get(),
"Real time elapsed on the host"),
ADD_STAT(hostTickRate, Stats::units::Rate<
Stats::units::Tick, Stats::units::Second>::get(),
ADD_STAT(hostTickRate, statistics::units::Rate<
statistics::units::Tick, statistics::units::Second>::get(),
"The number of ticks simulated per host second (ticks/s)"),
ADD_STAT(hostMemory, Stats::units::Byte::get(),
ADD_STAT(hostMemory, statistics::units::Byte::get(),
"Number of bytes of host memory used"),
statTime(true),
@@ -105,7 +105,7 @@ Root::RootStats::resetStats()
statTime.setTimer();
startTick = curTick();
Stats::Group::resetStats();
statistics::Group::resetStats();
}
/*

View File

@@ -91,18 +91,18 @@ class Root : public SimObject
}
public: // Global statistics
struct RootStats : public Stats::Group
struct RootStats : public statistics::Group
{
void resetStats() override;
Stats::Formula simSeconds;
Stats::Value simTicks;
Stats::Value finalTick;
Stats::Value simFreq;
Stats::Value hostSeconds;
statistics::Formula simSeconds;
statistics::Value simTicks;
statistics::Value finalTick;
statistics::Value simFreq;
statistics::Value hostSeconds;
Stats::Formula hostTickRate;
Stats::Value hostMemory;
statistics::Formula hostTickRate;
statistics::Value hostMemory;
static RootStats instance;

View File

@@ -54,7 +54,7 @@ SimObjectResolver *SimObject::_objNameResolver = NULL;
//
SimObject::SimObject(const Params &p)
: EventManager(getEventQueue(p.eventq_index)),
Stats::Group(nullptr),
statistics::Group(nullptr),
_params(p)
{
#ifdef DEBUG

View File

@@ -140,7 +140,7 @@ class SimObjectResolver;
* \endcode
*/
class SimObject : public EventManager, public Serializable, public Drainable,
public Stats::Group
public statistics::Group
{
private:
typedef std::vector<SimObject *> SimObjectList;

View File

@@ -192,7 +192,7 @@ doSimLoop(EventQueue *eventq)
// routines want to schedule new events.
std::lock_guard<EventQueue> lock(*eventq);
if (async_statdump || async_statreset) {
Stats::schedStatEvent(async_statdump, async_statreset);
statistics::schedStatEvent(async_statdump, async_statreset);
async_statdump = false;
async_statreset = false;
}

View File

@@ -54,7 +54,9 @@
#include "base/time.hh"
#include "sim/global_event.hh"
namespace Stats {
GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
namespace statistics
{
GlobalEvent *dumpEvent;
@@ -84,13 +86,14 @@ class StatEvent : public GlobalEvent
process()
{
if (dump)
Stats::dump();
statistics::dump();
if (reset)
Stats::reset();
statistics::reset();
if (repeat) {
Stats::schedStatEvent(dump, reset, curTick() + repeat, repeat);
statistics::schedStatEvent(dump, reset, curTick() + repeat,
repeat);
}
}
@@ -112,10 +115,10 @@ periodicStatDump(Tick period)
{
/*
* If the period is set to 0, then we do not want to dump periodically,
* thus we deschedule the event. Else, if the period is not 0, but the event
* has already been scheduled, we need to get rid of the old event before we
* create a new one, as the old event will no longer be moved forward in the
* event that we resume from a checkpoint.
* thus we deschedule the event. Else, if the period is not 0, but the
* event has already been scheduled, we need to get rid of the old event
* before we create a new one, as the old event will no longer be moved
* forward in the event that we resume from a checkpoint.
*/
if (dumpEvent != NULL && (period == 0 || dumpEvent->scheduled())) {
// Event should AutoDelete, so we do not need to free it.
@@ -153,4 +156,4 @@ updateEvents()
}
}
} // namespace Stats
} // namespace statistics

View File

@@ -44,7 +44,9 @@
#include "base/types.hh"
#include "sim/core.hh"
namespace Stats {
GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
namespace statistics
{
void initSimStats();
@@ -76,6 +78,6 @@ void schedStatEvent(bool dump, bool reset, Tick when = curTick(),
* @param period The period at which the dumping should occur.
*/
void periodicStatDump(Tick period = 0);
} // namespace Stats
} // namespace statistics
#endif // __SIM_STAT_CONTROL_HH__

View File

@@ -39,7 +39,8 @@
#include "base/statistics.hh"
namespace Stats
GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
namespace statistics
{
extern void pythonDump();
@@ -50,4 +51,4 @@ void registerPythonStatsHandlers()
registerHandlers(pythonReset, pythonDump);
}
} // namespace Stats
} // namespace statistics

View File

@@ -42,12 +42,15 @@
#ifndef __SIM_STAT_REGISTER_H__
#define __SIM_STAT_REGISTER_H__
namespace Stats
#include "base/compiler.hh"
GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
namespace statistics
{
/** Register py_... functions as the statistics handlers */
void registerPythonStatsHandlers();
} // namespace Stats
} // namespace statistics
#endif // __SIM_STAT_REGISTER_H__

View File

@@ -39,7 +39,7 @@
#include "sim/root.hh"
Stats::Formula &simSeconds = rootStats.simSeconds;
Stats::Value &simTicks = rootStats.simTicks;
Stats::Value &simFreq = rootStats.simFreq;
Stats::Value &hostSeconds = rootStats.hostSeconds;
statistics::Formula &simSeconds = rootStats.simSeconds;
statistics::Value &simTicks = rootStats.simTicks;
statistics::Value &simFreq = rootStats.simFreq;
statistics::Value &hostSeconds = rootStats.hostSeconds;

View File

@@ -31,9 +31,9 @@
#include "base/statistics.hh"
extern Stats::Formula &simSeconds;
extern Stats::Value &simTicks;
extern Stats::Value &simFreq;
extern Stats::Value &hostSeconds;
extern statistics::Formula &simSeconds;
extern statistics::Value &simTicks;
extern statistics::Value &simFreq;
extern statistics::Value &hostSeconds;
#endif // __SIM_SIM_STATS_HH__

View File

@@ -460,7 +460,7 @@ System::regStats()
SimObject::regStats();
for (uint32_t j = 0; j < numWorkIds ; j++) {
workItemStats[j] = new Stats::Histogram(this);
workItemStats[j] = new statistics::Histogram(this);
std::stringstream namestr;
ccprintf(namestr, "work_item_type%d", j);
workItemStats[j]->init(20)
@@ -592,7 +592,7 @@ System::_getRequestorId(const SimObject* requestor,
// Otherwise objects will have sized their stat buckets and
// they will be too small
if (Stats::enabled()) {
if (statistics::enabled()) {
fatal("Can't request a requestorId after regStats(). "
"You must do so in init().\n");
}

View File

@@ -597,7 +597,7 @@ class System : public SimObject, public PCEventScope
public:
std::map<std::pair<uint32_t, uint32_t>, Tick> lastWorkItemStarted;
std::map<uint32_t, Stats::Histogram*> workItemStats;
std::map<uint32_t, statistics::Histogram*> workItemStats;
////////////////////////////////////////////
//

View File

@@ -42,14 +42,14 @@
#include "sim/serialize.hh"
Ticked::Ticked(ClockedObject &object_,
Stats::Scalar *imported_num_cycles,
statistics::Scalar *imported_num_cycles,
Event::Priority priority) :
object(object_),
event([this]{ processClockEvent(); }, object_.name(), false, priority),
running(false),
lastStopped(0),
/* Allocate numCycles if an external stat wasn't passed in */
numCyclesLocal((imported_num_cycles ? NULL : new Stats::Scalar)),
numCyclesLocal((imported_num_cycles ? NULL : new statistics::Scalar)),
numCycles((imported_num_cycles ? *imported_num_cycles :
*numCyclesLocal))
{ }

View File

@@ -75,21 +75,21 @@ class Ticked : public Serializable
private:
/** Locally allocated stats */
Stats::Scalar *numCyclesLocal;
statistics::Scalar *numCyclesLocal;
protected:
/** Total number of cycles either ticked or spend stopped */
Stats::Scalar &numCycles;
statistics::Scalar &numCycles;
/** Number of cycles ticked */
Stats::Scalar tickCycles;
statistics::Scalar tickCycles;
/** Number of cycles stopped */
Stats::Formula idleCycles;
statistics::Formula idleCycles;
public:
Ticked(ClockedObject &object_,
Stats::Scalar *imported_num_cycles = NULL,
statistics::Scalar *imported_num_cycles = NULL,
Event::Priority priority = Event::CPU_Tick_Pri);
virtual ~Ticked() { }

View File

@@ -138,8 +138,8 @@ VoltageDomain::unserialize(CheckpointIn &cp)
}
VoltageDomain::VoltageDomainStats::VoltageDomainStats(VoltageDomain &vd)
: Stats::Group(&vd),
ADD_STAT(voltage, Stats::units::Volt::get(), "Voltage in Volts")
: statistics::Group(&vd),
ADD_STAT(voltage, statistics::units::Volt::get(), "Voltage in Volts")
{
voltage.method(&vd, &VoltageDomain::voltage);
}

View File

@@ -138,14 +138,14 @@ class VoltageDomain : public SimObject
const Voltages voltageOpPoints;
PerfLevel _perfLevel;
struct VoltageDomainStats : public Stats::Group
struct VoltageDomainStats : public statistics::Group
{
VoltageDomainStats(VoltageDomain &vd);
/**
* Stat for reporting voltage of the domain
*/
Stats::Value voltage;
statistics::Value voltage;
} stats;
/**

View File

@@ -46,23 +46,24 @@ class Workload : public SimObject
protected:
virtual Addr fixFuncEventAddr(Addr addr) const { return addr; }
struct WorkloadStats : public Stats::Group
struct WorkloadStats : public statistics::Group
{
struct InstStats: public Stats::Group
struct InstStats: public statistics::Group
{
Stats::Scalar arm;
Stats::Scalar quiesce;
statistics::Scalar arm;
statistics::Scalar quiesce;
InstStats(Stats::Group *parent) : Stats::Group(parent, "inst"),
ADD_STAT(arm, Stats::units::Count::get(),
InstStats(statistics::Group *parent)
: statistics::Group(parent, "inst"),
ADD_STAT(arm, statistics::units::Count::get(),
"number of arm instructions executed"),
ADD_STAT(quiesce, Stats::units::Count::get(),
ADD_STAT(quiesce, statistics::units::Count::get(),
"number of quiesce instructions executed")
{}
} instStats;
WorkloadStats(Workload *workload) : Stats::Group(workload),
WorkloadStats(Workload *workload) : statistics::Group(workload),
instStats(workload)
{}
} stats;