2c2
< * Copyright (c) 2012-2013 ARM Limited
---
> * Copyright (c) 2012-2013, 2015-2016 ARM Limited
39a40,41
> * Akash Bagdia
> * David Guillen Fandos
49a52
> #include "base/callback.hh"
51a55
> #include "enums/PwrState.hh"
236c240,283
< : SimObject(p), Clocked(*p->clk_domain) { }
---
> : SimObject(p), Clocked(*p->clk_domain),
> _currPwrState(p->default_p_state),
> prvEvalTick(0)
> { }
>
> /** Parameters of ClockedObject */
> typedef ClockedObjectParams Params;
> const Params* params() const
> { return reinterpret_cast<const Params*>(_params); }
>
> void serialize(CheckpointOut &cp) const override;
> void unserialize(CheckpointIn &cp) override;
>
> inline Enums::PwrState pwrState() const
> { return _currPwrState; }
>
> inline std::string pwrStateName() const
> { return Enums::PwrStateStrings[_currPwrState]; }
>
> /** Returns the percentage residency for each power state */
> std::vector<double> pwrStateWeights() const;
>
> /**
> * Record stats values like state residency by computing the time
> * difference from previous update. Also, updates the previous evaluation
> * tick once all stats are recorded.
> * Usually called on power state change and stats dump callback.
> */
> void computeStats();
>
> void pwrState(Enums::PwrState);
> void regStats();
>
> protected:
>
> /** To keep track of the current power state */
> Enums::PwrState _currPwrState;
>
> Tick prvEvalTick;
>
> Stats::Scalar numPwrStateTransitions;
> Stats::Distribution pwrStateClkGateDist;
> Stats::Vector pwrStateResidencyTicks;
>
238a286,293
> class ClockedObjectDumpCallback : public Callback
> {
> ClockedObject *co;
> public:
> ClockedObjectDumpCallback(ClockedObject *co_t) : co(co_t) {}
> virtual void process() { co->computeStats(); };
> };
>