#ifndef __MEM_CACHE_CACHE_HH__
#define __MEM_CACHE_CACHE_HH__
+#include <unordered_set>
+
#include "base/misc.hh" // fatal, panic, and warn
#include "enums/Clusivity.hh"
#include "mem/cache/base.hh"
#ifndef __MEM_COHERENT_XBAR_HH__
#define __MEM_COHERENT_XBAR_HH__
+#include <unordered_set>
+
#include "mem/snoop_filter.hh"
#include "mem/xbar.hh"
#include "params/CoherentXBar.hh"
#include "sim/drain.hh"
+#include <algorithm>
+
#include "base/misc.hh"
#include "base/trace.hh"
#include "debug/Drain.hh"
void
DrainManager::signalDrainDone()
{
+ assert(_count > 0);
if (--_count == 0) {
DPRINTF(Drain, "All %u objects drained..\n", drainableCount());
exitSimLoop("Finished drain", 0);
DrainManager::registerDrainable(Drainable *obj)
{
std::lock_guard<std::mutex> lock(globalLock);
- _allDrainable.insert(obj);
+ assert(std::find(_allDrainable.begin(), _allDrainable.end(), obj) ==
+ _allDrainable.end());
+ _allDrainable.push_back(obj);
}
void
DrainManager::unregisterDrainable(Drainable *obj)
{
std::lock_guard<std::mutex> lock(globalLock);
- _allDrainable.erase(obj);
+ auto o = std::find(_allDrainable.begin(), _allDrainable.end(), obj);
+ assert(o != _allDrainable.end());
+ _allDrainable.erase(o);
}
size_t
#include <atomic>
#include <mutex>
-#include <unordered_set>
+#include <vector>
class Drainable;
mutable std::mutex globalLock;
/** Set of all drainable objects */
- std::unordered_set<Drainable *> _allDrainable;
+ std::vector<Drainable *> _allDrainable;
/**
* Number of objects still draining. This is flagged atomic since