687c687
< writeQueue.empty() && readQueue.empty()) {
---
> writeQueue.empty() && readQueue.empty() && allRanksDrained()) {
1290a1291,1293
> // not done draining until in PWR_IDLE state
> // ensuring all banks are closed and
> // have exited low power states
1292c1295
< respQueue.empty()) {
---
> respQueue.empty() && allRanksDrained()) {
1540a1544,1546
>
> // Update the stats
> updatePowerStats();
1711,1727d1716
< // All commands up to refresh have completed
< // flush cmdList to DRAMPower
< flushCmdList();
<
< // update the counters for DRAMPower, passing false to
< // indicate that this is not the last command in the
< // list. DRAMPower requires this information for the
< // correct calculation of the background energy at the end
< // of the simulation. Ideally we would want to call this
< // function with true once at the end of the
< // simulation. However, the discarded energy is extremly
< // small and does not effect the final results.
< power.powerlib.updateCounters(false);
<
< // call the energy function
< power.powerlib.calcEnergy();
<
1835a1825,1841
> // All commands up to refresh have completed
> // flush cmdList to DRAMPower
> flushCmdList();
>
> // update the counters for DRAMPower, passing false to
> // indicate that this is not the last command in the
> // list. DRAMPower requires this information for the
> // correct calculation of the background energy at the end
> // of the simulation. Ideally we would want to call this
> // function with true once at the end of the
> // simulation. However, the discarded energy is extremly
> // small and does not effect the final results.
> power.powerlib.updateCounters(false);
>
> // call the energy function
> power.powerlib.calcEnergy();
>
2185c2191,2193
< if (!(writeQueue.empty() && readQueue.empty() && respQueue.empty())) {
---
> if (!(writeQueue.empty() && readQueue.empty() && respQueue.empty() &&
> allRanksDrained())) {
>
2200a2209,2221
> bool
> DRAMCtrl::allRanksDrained() const
> {
> // true until proven false
> bool all_ranks_drained = true;
> for (auto r : ranks) {
> // then verify that the power state is IDLE
> // ensuring all banks are closed and rank is not in a low power state
> all_ranks_drained = r->inPwrIdleState() && all_ranks_drained;
> }
> return all_ranks_drained;
> }
>