changeset eb34ae5204b8 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=eb34ae5204b8
description:
        mem: CommMonitor trace warn on non-timing mode

        Add a warning to the CommMonitor which will alert the user if they try
        and record a trace when the system is not in timing mode.

diffstat:

 src/mem/CommMonitor.py  |   4 ++++
 src/mem/comm_monitor.cc |  10 +++++++++-
 src/mem/comm_monitor.hh |   4 ++++
 3 files changed, 17 insertions(+), 1 deletions(-)

diffs (70 lines):

diff -r 013bba88efab -r eb34ae5204b8 src/mem/CommMonitor.py
--- a/src/mem/CommMonitor.py    Sun Mar 23 11:11:39 2014 -0400
+++ b/src/mem/CommMonitor.py    Sun Mar 23 11:11:40 2014 -0400
@@ -37,7 +37,9 @@
 #          Andreas Hansson
 
 from m5.params import *
+from m5.proxy import *
 from MemObject import MemObject
+from System import System
 
 # The communication monitor will most typically be used in combination
 # with periodic dumping and resetting of stats using schedStatEvent
@@ -45,6 +47,8 @@
     type = 'CommMonitor'
     cxx_header = "mem/comm_monitor.hh"
 
+    system = Param.System(Parent.any, "System that the monitor belongs to.")
+
     # one port in each direction
     master = MasterPort("Master port")
     slave = SlavePort("Slave port")
diff -r 013bba88efab -r eb34ae5204b8 src/mem/comm_monitor.cc
--- a/src/mem/comm_monitor.cc   Sun Mar 23 11:11:39 2014 -0400
+++ b/src/mem/comm_monitor.cc   Sun Mar 23 11:11:40 2014 -0400
@@ -55,7 +55,8 @@
       readAddrMask(params->read_addr_mask),
       writeAddrMask(params->write_addr_mask),
       stats(params),
-      traceStream(NULL)
+      traceStream(NULL),
+      system(params->system)
 {
     // If we are using a trace file, then open the file,
     if (params->trace_file != "") {
@@ -106,6 +107,13 @@
     // make sure both sides of the monitor are connected
     if (!slavePort.isConnected() || !masterPort.isConnected())
         fatal("Communication monitor is not connected on both sides.\n");
+
+    if (traceStream != NULL) {
+        // Check the memory mode. We only record something when in
+        // timing mode. Warn accordingly.
+        if (!system->isTimingMode())
+            warn("%s: Not in timing mode. No trace will be recorded.", name());
+    }
 }
 
 BaseMasterPort&
diff -r 013bba88efab -r eb34ae5204b8 src/mem/comm_monitor.hh
--- a/src/mem/comm_monitor.hh   Sun Mar 23 11:11:39 2014 -0400
+++ b/src/mem/comm_monitor.hh   Sun Mar 23 11:11:40 2014 -0400
@@ -46,6 +46,7 @@
 #include "mem/mem_object.hh"
 #include "params/CommMonitor.hh"
 #include "proto/protoio.hh"
+#include "sim/system.hh"
 
 /**
  * The communication monitor is a MemObject which can monitor statistics of
@@ -418,6 +419,9 @@
 
     /** Output stream for a potential trace. */
     ProtoOutputStream* traceStream;
+
+    /** The system in which the monitor lives */
+    System *system;
 };
 
 #endif //__MEM_COMM_MONITOR_HH__
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to