mem: Fix guest corruption when caches handle uncacheable accesses
[gem5.git] / src / mem / comm_monitor.hh
index 4b90306e18da9b8d120a3129dbd8e27d49e047ca..271ae5fff2060af702eade3c13beac173654da0a 100644 (file)
@@ -45,6 +45,7 @@
 #include "base/time.hh"
 #include "mem/mem_object.hh"
 #include "params/CommMonitor.hh"
+#include "proto/protoio.hh"
 
 /**
  * The communication monitor is a MemObject which can monitor statistics of
@@ -75,13 +76,19 @@ class CommMonitor : public MemObject
     CommMonitor(Params* params);
 
     /** Destructor */
-    ~CommMonitor() { }
+    ~CommMonitor() {}
 
-    virtual MasterPort& getMasterPort(const std::string& if_name,
-                                      int idx = -1);
+    /**
+     * Callback to flush and close all open output streams on exit. If
+     * we were calling the destructor it could be done there.
+     */
+    void closeStreams();
 
-    virtual SlavePort& getSlavePort(const std::string& if_name,
-                                    int idx = -1);
+    virtual BaseMasterPort& getMasterPort(const std::string& if_name,
+                                          PortID idx = InvalidPortID);
+
+    virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+                                        PortID idx = InvalidPortID);
 
     virtual void init();
 
@@ -427,6 +434,9 @@ class CommMonitor : public MemObject
 
     /** Instantiate stats */
     MonitorStats stats;
+
+    /** Output stream for a potential trace. */
+    ProtoOutputStream* traceStream;
 };
 
 #endif //__MEM_COMM_MONITOR_HH__