48 _currPwrState(p->default_p_state),
53 for (
auto & power_model: p->power_model)
54 power_model->setClockedObject(
this);
69 unsigned int currPwrState;
82 warn_once(
"ClockedObject: Already in the requested power state, " \
95 warn(
"ClockedObject %s: More than one power state change request "\
96 "encountered within the same simulation tick %d",
140 ret.resize(Enums::PwrState::Num_PwrState);
141 for (
unsigned i = 0;
i < Enums::PwrState::Num_PwrState;
i++)
142 ret[
i] = residencies[
i] / \
153 "Number of power state transitions"),
155 "Distribution of time spent in the clock gated state"),
157 "Cumulative time (in ticks) in various power states")
166 using namespace Stats;
173 unsigned num_bins = std::max(p->p_state_clk_gate_bins, 10U);
175 .
init(p->p_state_clk_gate_min, p->p_state_clk_gate_max,
176 (p->p_state_clk_gate_max / num_bins))
181 .
init(Enums::PwrState::Num_PwrState)
184 for (
int i = 0;
i < Enums::PwrState::Num_PwrState;
i++) {
const FlagsType pdf
Print the percent of the total that this entry represents.
Stats::Vector pwrStateResidencyTicks
std::vector< double > pwrStateWeights() const
Returns the percentage residency for each power state.
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
void computeStats()
Record stats values like state residency by computing the time difference from previous update...
const FlagsType nonan
Don't print if this is NAN.
ClockedObjectStats(ClockedObject &co)
void preDumpStats() override
Callback before stats are dumped.
Result total() const
Return a total of all entries in this vector.
virtual void regStats()
Callback to set stat parameters.
void value(VCounter &vec) const
ClockedObject::ClockedObjectStats stats
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
const Params * params() const
Derived & init(size_type size)
Set this vector to have the given size.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
#define UNSERIALIZE_SCALAR(scalar)
Tick curTick()
The current simulated tick.
Stats::Distribution pwrStateClkGateDist
uint64_t Tick
Tick count type.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
virtual void preDumpStats()
Callback before stats are dumped.
void serialize(CheckpointOut &cp) const override
Serialize an object.
ClockedObject declaration and implementation.
void regStats() override
Callback to set stat parameters.
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
Helper class for objects that need to be clocked.
virtual const std::string name() const
#define SERIALIZE_SCALAR(scalar)
Stats::Scalar numPwrStateTransitions
Enums::PwrState pwrState() const
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
std::ostream CheckpointOut
ClockedObject & clockedObject
const FlagsType nozero
Don't print if this is zero.
Enums::PwrState _currPwrState
To keep track of the current power state.
Abstract superclass for simulation objects.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
ClockedObject(const ClockedObjectParams *p)