73c73,74
< minWritesPerSwitch(p->min_writes_per_switch), writesThisTime(0),
---
> minWritesPerSwitch(p->min_writes_per_switch),
> writesThisTime(0), readsThisTime(0),
402,403d402
< ++writesThisTime;
<
407c406,407
< // If we emptied the write queue, or got below the threshold and
---
> // If we emptied the write queue, or got sufficiently below the
> // threshold (using the minWritesPerSwitch as the hysteresis) and
412c412,413
< (writeQueue.size() < writeLowThreshold && !drainManager) ||
---
> (writeQueue.size() + minWritesPerSwitch < writeLowThreshold &&
> !drainManager) ||
416a418,422
>
> DPRINTF(DRAM, "Switching to reads after %d writes with %d writes "
> "waiting\n", writesThisTime, writeQueue.size());
>
> wrPerTurnAround.sample(writesThisTime);
444c450,452
< DPRINTF(DRAM, "Writes triggered at %lld\n", curTick());
---
> DPRINTF(DRAM, "Switching to writes after %d reads with %d reads "
> "waiting\n", readsThisTime, readQueue.size());
>
451a460,464
> // there is some danger here as there might still be reads
> // happening before the switch actually takes place
> rdPerTurnAround.sample(readsThisTime);
> readsThisTime = 0;
>
1200a1214
> ++readsThisTime;
1205a1220
> ++writesThisTime;
1520a1536,1547
> rdPerTurnAround
> .init(readBufferSize)
> .name(name() + ".rdPerTurnAround")
> .desc("Reads before turning the bus around for writes")
> .flags(nozero);
>
> wrPerTurnAround
> .init(writeBufferSize)
> .name(name() + ".wrPerTurnAround")
> .desc("Writes before turning the bus around for reads")
> .flags(nozero);
>