From 658849d101c98b6d8c7a06f41ffbe39675848eac Mon Sep 17 00:00:00 2001
From: Nilay Vaish <nilay@cs.wisc.edu>
Date: Wed, 1 Dec 2010 11:30:04 -0800
Subject: ruby: Converted old ruby debug calls to M5 debug calls

This patch developed by Nilay Vaish converts all the old GEMS-style ruby
debug calls to the appropriate M5 debug calls.
---
 src/mem/ruby/SConsopts                             |  3 +-
 src/mem/ruby/buffers/MessageBuffer.cc              | 47 +++++++-----------
 src/mem/ruby/common/Debug.cc                       |  7 ---
 src/mem/ruby/common/Debug.hh                       | 57 ----------------------
 src/mem/ruby/common/NetDest.hh                     |  2 +-
 .../garnet/fixed-pipeline/NetworkInterface_d.cc    |  5 +-
 .../ruby/network/garnet/fixed-pipeline/Switch_d.cc |  4 +-
 .../garnet/flexible-pipeline/NetworkInterface.cc   |  5 +-
 .../network/garnet/flexible-pipeline/Router.cc     |  4 +-
 src/mem/ruby/network/simple/PerfectSwitch.cc       | 31 +++++-------
 src/mem/ruby/network/simple/Throttle.cc            | 19 +++-----
 src/mem/ruby/network/simple/Topology.cc            | 12 ++---
 src/mem/ruby/storebuffer/storebuffer.cc            | 46 +++--------------
 src/mem/ruby/system/CacheMemory.cc                 | 14 +++---
 src/mem/ruby/system/DirectoryMemory.cc             |  2 +-
 src/mem/ruby/system/SConscript                     |  3 --
 src/mem/ruby/system/SparseMemory.cc                | 31 ++++++------
 src/mem/ruby/tester/RaceyPseudoThread.cc           |  4 +-
 18 files changed, 82 insertions(+), 214 deletions(-)

(limited to 'src/mem/ruby')

diff --git a/src/mem/ruby/SConsopts b/src/mem/ruby/SConsopts
index 95ca71fdd..7aa3e2c4e 100644
--- a/src/mem/ruby/SConsopts
+++ b/src/mem/ruby/SConsopts
@@ -32,9 +32,8 @@ Import('*')
 
 sticky_vars.AddVariables(
     BoolVariable('NO_VECTOR_BOUNDS_CHECKS', "Don't do bounds checks", True),
-    BoolVariable('RUBY_DEBUG', "Add debugging stuff to Ruby", False),
     ('GEMS_ROOT', "Add debugging stuff to Ruby", Dir('..').srcnode().abspath),
     )
 
-export_vars += [ 'NO_VECTOR_BOUNDS_CHECKS', 'RUBY_DEBUG', 'GEMS_ROOT' ]
+export_vars += [ 'NO_VECTOR_BOUNDS_CHECKS', 'GEMS_ROOT' ]
 
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc
index 7d28cef22..2a86f1bab 100644
--- a/src/mem/ruby/buffers/MessageBuffer.cc
+++ b/src/mem/ruby/buffers/MessageBuffer.cc
@@ -99,10 +99,9 @@ MessageBuffer::areNSlotsAvailable(int n)
     if (current_size + n <= m_max_size) {
         return true;
     } else {
-        DEBUG_MSG(QUEUE_COMP, MedPrio, n);
-        DEBUG_MSG(QUEUE_COMP, MedPrio, current_size);
-        DEBUG_MSG(QUEUE_COMP, MedPrio, m_size);
-        DEBUG_MSG(QUEUE_COMP, MedPrio, m_max_size);
+        DPRINTF(RubyQueue, "n: %d, current_size: %d, m_size: %d, "
+                "m_max_size: %d\n",
+                n, current_size, m_size, m_max_size);
         m_not_avail_count++;
         return false;
     }
@@ -119,18 +118,14 @@ MessageBuffer::getMsgPtrCopy() const
 const Message*
 MessageBuffer::peekAtHeadOfQueue() const
 {
-    DEBUG_NEWLINE(QUEUE_COMP, MedPrio);
-
-    DEBUG_MSG(QUEUE_COMP, MedPrio,
-              csprintf("Peeking at head of queue %s time: %d.",
-                       m_name, g_eventQueue_ptr->getTime()));
+    DPRINTF(RubyQueue, "Peeking at head of queue %s time: %lld\n",
+            m_name, g_eventQueue_ptr->getTime());
     assert(isReady());
 
     const Message* msg_ptr = m_prio_heap.front().m_msgptr.get();
     assert(msg_ptr);
 
-    DEBUG_EXPR(QUEUE_COMP, MedPrio, *msg_ptr);
-    DEBUG_NEWLINE(QUEUE_COMP, MedPrio);
+    DPRINTF(RubyQueue, "Message: %s\n", (*msg_ptr));
     return msg_ptr;
 }
 
@@ -149,12 +144,8 @@ random_time()
 void
 MessageBuffer::enqueue(MsgPtr message, Time delta)
 {
-    DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
-    DEBUG_MSG(QUEUE_COMP, HighPrio,
-              csprintf("enqueue %s time: %d.", m_name,
-                       g_eventQueue_ptr->getTime()));
-    DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
-    DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
+    DPRINTF(RubyQueue, "Enqueue %s time: %lld, message: %s.\n",
+            m_name, g_eventQueue_ptr->getTime(), (*(message.get())));
 
     m_msg_counter++;
     m_size++;
@@ -229,12 +220,10 @@ MessageBuffer::enqueue(MsgPtr message, Time delta)
     push_heap(m_prio_heap.begin(), m_prio_heap.end(),
         greater<MessageBufferNode>());
 
-    DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
-    DEBUG_MSG(QUEUE_COMP, HighPrio,
-              csprintf("enqueue %s with arrival_time %d cur_time: %d.",
-                       m_name, arrival_time, g_eventQueue_ptr->getTime()));
-    DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
-    DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
+    DPRINTF(RubyQueue, "Enqueue %s with arrival_time %lld cur_time: %lld, "
+            "message: %s.\n",
+            m_name, arrival_time, g_eventQueue_ptr->getTime(),
+            (*(message.get())));
 
     // Schedule the wakeup
     if (m_consumer_ptr != NULL) {
@@ -263,11 +252,11 @@ MessageBuffer::dequeue_getDelayCycles(MsgPtr& message)
 void
 MessageBuffer::dequeue(MsgPtr& message)
 {
-    DEBUG_MSG(QUEUE_COMP, MedPrio, "dequeue from " + m_name);
+    DPRINTF(RubyQueue, "Dequeue from %s\n", m_name);
     message = m_prio_heap.front().m_msgptr;
 
     pop();
-    DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
+    DPRINTF(RubyQueue, "Enqueue message is %s\n", (*(message.get())));
 }
 
 int
@@ -290,7 +279,7 @@ MessageBuffer::dequeue_getDelayCycles()
 void
 MessageBuffer::pop()
 {
-    DEBUG_MSG(QUEUE_COMP, MedPrio, "pop from " + m_name);
+    DPRINTF(RubyQueue, "Pop from %s\n", m_name);
     assert(isReady());
     pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
         greater<MessageBufferNode>());
@@ -321,7 +310,7 @@ MessageBuffer::clear()
 void
 MessageBuffer::recycle()
 {
-    DEBUG_MSG(QUEUE_COMP, MedPrio, "recycling " + m_name);
+    DPRINTF(RubyQueue, "Recycling %s\n", m_name);
     assert(isReady());
     MessageBufferNode node = m_prio_heap.front();
     pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
@@ -337,7 +326,7 @@ MessageBuffer::recycle()
 void
 MessageBuffer::reanalyzeMessages(const Address& addr)
 {
-    DEBUG_MSG(QUEUE_COMP, MedPrio, "reanalyzeMessages " + m_name);
+    DPRINTF(RubyQueue, "ReanalyzeMessages %s\n", m_name);
     assert(m_stall_msg_map.count(addr) > 0);
 
     //
@@ -362,7 +351,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
 void
 MessageBuffer::stallMessage(const Address& addr)
 {
-    DEBUG_MSG(QUEUE_COMP, MedPrio, "stalling " + m_name);
+    DPRINTF(RubyQueue, "Stalling %s\n", m_name);
     assert(isReady());
     assert(addr.getOffset() == 0);
     MsgPtr message = m_prio_heap.front().m_msgptr;
diff --git a/src/mem/ruby/common/Debug.cc b/src/mem/ruby/common/Debug.cc
index eb6cc5c47..6995ef637 100644
--- a/src/mem/ruby/common/Debug.cc
+++ b/src/mem/ruby/common/Debug.cc
@@ -208,13 +208,6 @@ Debug::checkFilterString(const char *filter_str)
         return false; // no error
     }
 
-    if (RUBY_DEBUG == false) {
-        cerr << "Error: User specified set of debug components, but the "
-             << "RUBY_DEBUG compile-time flag is false." << endl
-             << "Solution: Re-compile with RUBY_DEBUG set to true." << endl;
-        return true; // error
-    }
-
     if (string(filter_str) == "all") {
         return false; // no error
     }
diff --git a/src/mem/ruby/common/Debug.hh b/src/mem/ruby/common/Debug.hh
index f8c18a0b5..7005d95f7 100644
--- a/src/mem/ruby/common/Debug.hh
+++ b/src/mem/ruby/common/Debug.hh
@@ -36,7 +36,6 @@
 #include <string>
 #include <vector>
 
-#include "config/ruby_debug.hh"
 #include "mem/ruby/common/Global.hh"
 #include "sim/sim_object.hh"
 
@@ -228,62 +227,6 @@ const bool ASSERT_FLAG = true;
     }                                                           \
 } while (0)
 
-#define DEBUG_MSG(module, priority, MESSAGE) do {               \
-    using namespace std;                                        \
-    if (RUBY_DEBUG) {                                           \
-        if (g_debug_ptr->validDebug(module, priority)) {        \
-            (* debug_cout_ptr) << "Debug: in fn "               \
-                               << __PRETTY_FUNCTION__           \
-                               << " in " << __FILE__ << ":"     \
-                               << __LINE__ << ": "              \
-                               << (MESSAGE) << endl << flush;   \
-        }                                                       \
-    }                                                           \
-} while (0)
-
-#define DEBUG_EXPR(module, priority, EXPR) do {                 \
-    using namespace std;                                        \
-    if (RUBY_DEBUG) {                                           \
-        if (g_debug_ptr->validDebug(module, priority)) {        \
-            (* debug_cout_ptr) << "Debug: in fn "               \
-                               << __PRETTY_FUNCTION__           \
-                               << " in " << __FILE__ << ":"     \
-                               << __LINE__ << ": "              \
-                               << #EXPR << " is "               \
-                               << (EXPR) << endl << flush;      \
-        }                                                       \
-    }                                                           \
-} while (0)
-
-#define DEBUG_NEWLINE(module, priority) do {                    \
-    using namespace std;                                        \
-    if (RUBY_DEBUG) {                                           \
-        if (g_debug_ptr->validDebug(module, priority)) {        \
-            (* debug_cout_ptr) << endl << flush;                \
-        }                                                       \
-    }                                                           \
-} while (0)
-
-#define DEBUG_SLICC(priority, LINE, MESSAGE) do {                       \
-    using namespace std;                                                \
-    if (RUBY_DEBUG) {                                                   \
-        if (g_debug_ptr->validDebug(SLICC_COMP, priority)) {            \
-            (* debug_cout_ptr) << (LINE) << (MESSAGE) << endl << flush; \
-        }                                                               \
-    }                                                                   \
-} while (0)
-
-#define DEBUG_OUT(rest... ) do {                \
-    using namespace std;                        \
-    if (RUBY_DEBUG) {                           \
-        cout << "Debug: in fn "                 \
-             << __PRETTY_FUNCTION__             \
-             << " in " << __FILE__ << ":"       \
-             << __LINE__ << ": ";               \
-        g_debug_ptr->debugMsg(rest);            \
-    }                                           \
-} while (0)
-
 #define ERROR_OUT( rest... ) do {               \
     using namespace std;                        \
     if (ERROR_MESSAGE_FLAG) {                   \
diff --git a/src/mem/ruby/common/NetDest.hh b/src/mem/ruby/common/NetDest.hh
index 3fe87f69b..dc4a54965 100644
--- a/src/mem/ruby/common/NetDest.hh
+++ b/src/mem/ruby/common/NetDest.hh
@@ -55,7 +55,7 @@ class NetDest
 
     ~NetDest()
     {
-        DEBUG_MSG(MEMORY_COMP, LowPrio, "NetDest Destructor");
+        DPRINTF(RubyMemory, "NetDest Destructor\n");
     }
 
     void add(MachineID newElement);
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
index a33776c17..16792ef2b 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -205,9 +205,8 @@ NetworkInterface_d::calculateVC(int vnet)
 void
 NetworkInterface_d::wakeup()
 {
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, m_id);
-    DEBUG_MSG(NETWORK_COMP, MedPrio, "NI WOKE UP");
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, g_eventQueue_ptr->getTime());
+    DPRINTF(RubyNetwork, "m_id: %d woke up at time: %lld",
+            m_id, g_eventQueue_ptr->getTime());
 
     MsgPtr msg_ptr;
 
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
index de57944f1..50aa16cea 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
@@ -62,8 +62,8 @@ Switch_d::init()
 void
 Switch_d::wakeup()
 {
-    DEBUG_MSG(NETWORK_COMP, HighPrio, "Switch woke up");
-    DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+    DPRINTF(RubyNetwork, "Switch woke up at time: %lld\n",
+            g_eventQueue_ptr->getTime());
 
     for (int inport = 0; inport < m_num_inports; inport++) {
         if (!m_switch_buffer[inport]->isReady())
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 86f9483c6..23efaa618 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -258,9 +258,8 @@ NetworkInterface::wakeup()
     if (inNetLink->isReady()) {
         flit *t_flit = inNetLink->consumeLink();
         if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) {
-            DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
-            DEBUG_MSG(NETWORK_COMP, HighPrio, "Message got delivered");
-            DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+            DPRINTF(RubyNetwork, "m_id: %d, Message delivered at time: %lld\n",
+                    m_id, g_eventQueue_ptr->getTime());
 
             // When we are doing network only testing, the messages do not
             // have to be buffered into the message buffers of the protocol
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
index ca75edb58..ce90c9748 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
@@ -309,8 +309,8 @@ Router::wakeup()
 
         // checking the incoming link
         if (m_in_link[incoming_port]->isReady()) {
-            DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
-            DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+            DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n",
+                    m_id, g_eventQueue_ptr->getTime());
             t_flit = m_in_link[incoming_port]->peekLink();
             routeCompute(t_flit, incoming_port);
             m_in_link[incoming_port]->consumeLink();
diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc
index 5a1ee32ec..7229c724f 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc
@@ -123,7 +123,7 @@ PerfectSwitch::~PerfectSwitch()
 void
 PerfectSwitch::wakeup()
 {
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, m_switch_id);
+    DPRINTF(RubyNetwork, "m_switch_id: %d\n",m_switch_id);
 
     MsgPtr msg_ptr;
 
@@ -168,12 +168,12 @@ PerfectSwitch::wakeup()
 
             // Is there a message waiting?
             while (m_in[incoming][vnet]->isReady()) {
-                DEBUG_EXPR(NETWORK_COMP, MedPrio, incoming);
+                DPRINTF(RubyNetwork, "incoming: %d\n", incoming);
 
                 // Peek at message
                 msg_ptr = m_in[incoming][vnet]->peekMsgPtr();
                 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get());
-                DEBUG_EXPR(NETWORK_COMP, MedPrio, *net_msg_ptr);
+                DPRINTF(RubyNetwork, "Message: %s\n", (*net_msg_ptr));
 
                 output_links.clear();
                 output_link_destinations.clear();
@@ -216,7 +216,7 @@ PerfectSwitch::wakeup()
                     // pick the next link to look at
                     int link = m_link_order[i].m_link;
                     NetDest dst = m_routing_table[link];
-                    DEBUG_EXPR(NETWORK_COMP, MedPrio, dst);
+                    DPRINTF(RubyNetwork, "dst: %s\n", dst);
 
                     if (!msg_dsts.intersectionIsNotEmpty(dst))
                         continue;
@@ -246,19 +246,17 @@ PerfectSwitch::wakeup()
                     int outgoing = output_links[i];
                     if (!m_out[outgoing][vnet]->areNSlotsAvailable(1))
                         enough = false;
-                    DEBUG_MSG(NETWORK_COMP, HighPrio,
-                        "checking if node is blocked");
-                    DEBUG_EXPR(NETWORK_COMP, HighPrio, outgoing);
-                    DEBUG_EXPR(NETWORK_COMP, HighPrio, vnet);
-                    DEBUG_EXPR(NETWORK_COMP, HighPrio, enough);
+                    DPRINTF(RubyNetwork, "Checking if node is blocked\n"
+                            "outgoing: %d, vnet: %d, enough: %d\n",
+                            outgoing, vnet, enough);
                 }
 
                 // There were not enough resources
                 if (!enough) {
                     g_eventQueue_ptr->scheduleEvent(this, 1);
-                    DEBUG_MSG(NETWORK_COMP, HighPrio,
-                        "Can't deliver message since a node is blocked");
-                    DEBUG_EXPR(NETWORK_COMP, HighPrio, *net_msg_ptr);
+                    DPRINTF(RubyNetwork, "Can't deliver message since a node "
+                            "is blocked\n"
+                            "Message: %s\n", (*net_msg_ptr));
                     break; // go to next incoming port
                 }
 
@@ -295,13 +293,10 @@ PerfectSwitch::wakeup()
                         output_link_destinations[i];
 
                     // Enqeue msg
-                    DEBUG_NEWLINE(NETWORK_COMP,HighPrio);
-                    DEBUG_MSG(NETWORK_COMP, HighPrio,
-                        csprintf("switch: %d enqueuing net msg from "
-                            "inport[%d][%d] to outport [%d][%d] time: %d.",
+                    DPRINTF(RubyNetwork, "Switch: %d enqueuing net msg from "
+                            "inport[%d][%d] to outport [%d][%d] time: %lld.\n",
                             m_switch_id, incoming, vnet, outgoing, vnet,
-                            g_eventQueue_ptr->getTime()));
-                    DEBUG_NEWLINE(NETWORK_COMP,HighPrio);
+                            g_eventQueue_ptr->getTime());
 
                     m_out[outgoing][vnet]->enqueue(msg_ptr);
                 }
diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index a77d40dee..096a8f466 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -161,12 +161,10 @@ Throttle::wakeup()
                 m_units_remaining[vnet] +=
                     network_message_to_size(net_msg_ptr);
 
-                DEBUG_NEWLINE(NETWORK_COMP,HighPrio);
-                DEBUG_MSG(NETWORK_COMP, HighPrio,
-                    csprintf("throttle: %d my bw %d bw spent enqueueing "
-                        "net msg %d time: %d.",
+                DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent "
+                        "enqueueing net msg %d time: %lld.\n",
                         m_node, getLinkBandwidth(), m_units_remaining[vnet],
-                        g_eventQueue_ptr->getTime()));
+                        g_eventQueue_ptr->getTime());
 
                 // Move the message
                 m_out[vnet]->enqueue(m_in[vnet]->peekMsgPtr(), m_link_latency);
@@ -175,8 +173,7 @@ Throttle::wakeup()
                 // Count the message
                 m_message_counters[net_msg_ptr->getMessageSize()][vnet]++;
 
-                DEBUG_MSG(NETWORK_COMP,LowPrio,*m_out[vnet]);
-                DEBUG_NEWLINE(NETWORK_COMP,HighPrio);
+                DPRINTF(RubyNetwork, "%s\n", *m_out[vnet]);
             }
 
             // Calculate the amount of bandwidth we spent on this message
@@ -188,7 +185,7 @@ Throttle::wakeup()
         if (bw_remaining > 0 &&
             (m_in[vnet]->isReady() || m_units_remaining[vnet] > 0) &&
             !m_out[vnet]->areNSlotsAvailable(1)) {
-            DEBUG_MSG(NETWORK_COMP,LowPrio,vnet);
+            DPRINTF(RubyNetwork, "vnet: %d", vnet);
             // schedule me to wakeup again because I'm waiting for my
             // output queue to become available
             schedule_wakeup = true;
@@ -209,11 +206,9 @@ Throttle::wakeup()
         // We have extra bandwidth and our output buffer was
         // available, so we must not have anything else to do until
         // another message arrives.
-        DEBUG_MSG(NETWORK_COMP, LowPrio, *this);
-        DEBUG_MSG(NETWORK_COMP, LowPrio, "not scheduled again");
+        DPRINTF(RubyNetwork, "%s not scheduled again\n", *this);
     } else {
-        DEBUG_MSG(NETWORK_COMP, LowPrio, *this);
-        DEBUG_MSG(NETWORK_COMP, LowPrio, "scheduled again");
+        DPRINTF(RubyNetwork, "%s scheduled again\n", *this);
 
         // We are out of bandwidth for this cycle, so wakeup next
         // cycle and continue
diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc
index bd167bd40..5e6bf9939 100644
--- a/src/mem/ruby/network/simple/Topology.cc
+++ b/src/mem/ruby/network/simple/Topology.cc
@@ -405,13 +405,11 @@ shortest_path_to_node(SwitchID src, SwitchID next, const Matrix& weights,
         }
     }
 
-    DEBUG_MSG(NETWORK_COMP, MedPrio, "returning shortest path");
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, (src-(2*max_machines)));
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, (next-(2*max_machines)));
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, src);
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, next);
-    DEBUG_EXPR(NETWORK_COMP, MedPrio, result);
-    DEBUG_NEWLINE(NETWORK_COMP, MedPrio);
+    DPRINTF(RubyNetwork, "Returning shortest path\n"
+            "(src-(2*max_machines)): %d, (next-(2*max_machines)): %d, "
+            "src: %d, next: %d, result: %s\n",
+            (src-(2*max_machines)), (next-(2*max_machines)),
+            src, next, result);
 
     return result;
 }
diff --git a/src/mem/ruby/storebuffer/storebuffer.cc b/src/mem/ruby/storebuffer/storebuffer.cc
index d6ec0959e..1549e33ee 100644
--- a/src/mem/ruby/storebuffer/storebuffer.cc
+++ b/src/mem/ruby/storebuffer/storebuffer.cc
@@ -43,7 +43,7 @@ hit(int64_t id)
 {
     if (request_map.find(id) == request_map.end()) {
         ERROR_OUT("Request ID not found in the map");
-        DEBUG_EXPR(STOREBUFFER_COMP, MedPrio, id);
+        DPRINTF(RubyStorebuffer, "id: %lld\n", id);
         ASSERT(0);
     } else {
         request_map[id]->complete(id);
@@ -73,11 +73,6 @@ StoreBuffer::StoreBuffer(uint32 id, uint32 block_bits, int storebuffer_size)
     if (m_storebuffer_size > 0){
         m_use_storebuffer = true;
     }
-
-#ifdef DEBUG_WRITE_BUFFER
-    DEBUG_OUT("*******storebuffer_t::Using Write Buffer? %d\n",
-              m_use_storebuffer);
-#endif
 }
 
 StoreBuffer::~StoreBuffer()
@@ -100,7 +95,7 @@ StoreBuffer::addToStoreBuffer(RubyRequest request)
         uint64_t id = libruby_issue_request(m_port, request);
         if (request_map.find(id) != request_map.end()) {
             ERROR_OUT("Request ID is already in the map");
-            DEBUG_EXPR(STOREBUFFER_COMP, MedPrio, id);
+            DPRINTF(RubyStorebuffer, "id: %lld\n", id);
             ASSERT(0);
         } else {
             request_map.insert(make_pair(id, this));
@@ -110,12 +105,6 @@ StoreBuffer::addToStoreBuffer(RubyRequest request)
     }
 
 
-#ifdef DEBUG_WRITE_BUFFER
-    DEBUG_OUT("\n***StoreBuffer: addToStoreBuffer BEGIN, contents:\n");
-    DEBUG_OUT("\n");
-    DEBUG_OUT("\t INSERTING new request\n");
-#endif
-
     buffer.push_front(SBEntry(request, NULL));
 
     m_buffer_size++;
@@ -128,11 +117,6 @@ StoreBuffer::addToStoreBuffer(RubyRequest request)
     }
 
     iseq++;
-
-#ifdef DEBUG_WRITE_BUFFER
-    DEBUG_OUT("***StoreBuffer: addToStoreBuffer END, contents:\n");
-    DEBUG_OUT("\n");
-#endif
 }
 
 
@@ -161,7 +145,7 @@ StoreBuffer::handleLoad(RubyRequest request)
         uint64_t id = libruby_issue_request(m_port, request);
         if (request_map.find(id) != request_map.end()) {
             ERROR_OUT("Request ID is already in the map");
-            DEBUG_EXPR(STOREBUFFER_COMP, MedPrio, id);
+            DPRINTF(RubyStorebuffer, "id: %lld\n", id);
             ASSERT(0);
         } else {
             request_map.insert(make_pair(id, this));
@@ -285,11 +269,6 @@ StoreBuffer::flushStoreBuffer()
         return;
     }
 
-#ifdef DEBUG_WRITE_BUFFER
-    DEBUG_OUT("\n***StoreBuffer: flushStoreBuffer BEGIN, contents:\n");
-    DEBUG_OUT("\n");
-#endif
-
     m_storebuffer_flushing = (m_buffer_size > 0);
 }
 
@@ -318,10 +297,6 @@ StoreBuffer::complete(uint64_t id)
     physical_address_t physical_address =
         outstanding_requests.find(id)->second.paddr;
     RubyRequestType type = outstanding_requests.find(id)->second.type;
-#ifdef DEBUG_WRITE_BUFFER
-    DEBUG_OUT("\n***StoreBuffer: complete BEGIN, contents:\n");
-    DEBUG_OUT("\n");
-#endif
 
     if (type == RubyRequestType_ST) {
         physical_address_t lineaddr = physical_address & m_block_mask;
@@ -357,10 +332,6 @@ StoreBuffer::complete(uint64_t id)
             ASSERT(0);
         }
 
-#ifdef DEBUG_WRITE_BUFFER
-        DEBUG_OUT("***StoreBuffer: complete END, contents:\n");
-        DEBUG_OUT("\n");
-#endif
     } else if (type == RubyRequestType_LD) {
         m_hit_callback(id);
     }
@@ -372,13 +343,10 @@ StoreBuffer::complete(uint64_t id)
 void
 StoreBuffer::print()
 {
-    DEBUG_OUT("[%d] StoreBuffer: Total entries: %d Outstanding: %d\n",
-              m_id, m_buffer_size);
+    DPRINTF(RubyStorebuffer, "[%d] StoreBuffer: Total entries: %d "
+            "Outstanding: %d\n",
+            m_id, m_storebuffer_size, m_buffer_size);
 
     if (!m_use_storebuffer)
-        DEBUG_OUT("\t WRITE BUFFER NOT USED\n");
+        DPRINTF(RubyStorebuffer, "\t WRITE BUFFER NOT USED\n");
 }
-
-
-
-
diff --git a/src/mem/ruby/system/CacheMemory.cc b/src/mem/ruby/system/CacheMemory.cc
index 59f97e5fe..87baebd0c 100644
--- a/src/mem/ruby/system/CacheMemory.cc
+++ b/src/mem/ruby/system/CacheMemory.cc
@@ -166,7 +166,7 @@ CacheMemory::tryCacheAccess(const Address& address, CacheRequestType type,
                             DataBlock*& data_ptr)
 {
     assert(address == line_address(address));
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
     Index cacheSet = addressToCacheSet(address);
     int loc = findTagInSet(cacheSet, address);
     if (loc != -1) {
@@ -194,7 +194,7 @@ CacheMemory::testCacheAccess(const Address& address, CacheRequestType type,
                              DataBlock*& data_ptr)
 {
     assert(address == line_address(address));
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
     Index cacheSet = addressToCacheSet(address);
     int loc = findTagInSet(cacheSet, address);
 
@@ -223,12 +223,10 @@ CacheMemory::isTagPresent(const Address& address) const
 
     if (loc == -1) {
         // We didn't find the tag
-        DEBUG_EXPR(CACHE_COMP, LowPrio, address);
-        DEBUG_MSG(CACHE_COMP, LowPrio, "No tag match");
+        DPRINTF(RubyCache, "No tag match for address: %s\n", address);
         return false;
     }
-    DEBUG_EXPR(CACHE_COMP, LowPrio, address);
-    DEBUG_MSG(CACHE_COMP, LowPrio, "found");
+    DPRINTF(RubyCache, "address: %s found\n", address);
     return true;
 }
 
@@ -263,7 +261,7 @@ CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry)
     assert(address == line_address(address));
     assert(!isTagPresent(address));
     assert(cacheAvail(address));
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
 
     // Find the first open slot
     Index cacheSet = addressToCacheSet(address);
@@ -292,7 +290,7 @@ CacheMemory::deallocate(const Address& address)
 {
     assert(address == line_address(address));
     assert(isTagPresent(address));
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
     Index cacheSet = addressToCacheSet(address);
     int loc = findTagInSet(cacheSet, address);
     if (loc != -1) {
diff --git a/src/mem/ruby/system/DirectoryMemory.cc b/src/mem/ruby/system/DirectoryMemory.cc
index fbb48d7f5..4a72dce33 100644
--- a/src/mem/ruby/system/DirectoryMemory.cc
+++ b/src/mem/ruby/system/DirectoryMemory.cc
@@ -157,7 +157,7 @@ DirectoryMemory::lookup(PhysAddress address)
     assert(isPresent(address));
     Directory_Entry* entry;
     uint64 idx;
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
 
     if (m_use_map) {
         if (m_sparseMemory->exist(address)) {
diff --git a/src/mem/ruby/system/SConscript b/src/mem/ruby/system/SConscript
index 6d1aff31d..edc9d451f 100644
--- a/src/mem/ruby/system/SConscript
+++ b/src/mem/ruby/system/SConscript
@@ -50,6 +50,3 @@ Source('RubyPort.cc')
 Source('Sequencer.cc', Werror=False)
 Source('System.cc')
 Source('TimerTable.cc')
-
-TraceFlag('RubyCache')
-TraceFlag('RubyDma')
diff --git a/src/mem/ruby/system/SparseMemory.cc b/src/mem/ruby/system/SparseMemory.cc
index c4f636322..376852826 100644
--- a/src/mem/ruby/system/SparseMemory.cc
+++ b/src/mem/ruby/system/SparseMemory.cc
@@ -112,7 +112,7 @@ SparseMemory::exist(const Address& address) const
     int highBit = m_total_number_of_bits + RubySystem::getBlockSizeBits();
     int lowBit;
     assert(address == line_address(address));
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
 
     for (int level = 0; level < m_number_of_levels; level++) {
         // Create the appropriate sub address for this level
@@ -122,10 +122,9 @@ SparseMemory::exist(const Address& address) const
         lowBit = highBit - m_number_of_bits_per_level[level];
         curAddress.setAddress(address.bitSelect(lowBit, highBit - 1));
 
-        DEBUG_EXPR(CACHE_COMP, HighPrio, level);
-        DEBUG_EXPR(CACHE_COMP, HighPrio, lowBit);
-        DEBUG_EXPR(CACHE_COMP, HighPrio, highBit - 1);
-        DEBUG_EXPR(CACHE_COMP, HighPrio, curAddress);
+        DPRINTF(RubyCache, "level: %d, lowBit: %d, highBit - 1: %d, "
+                "curAddress: %s\n",
+                level, lowBit, highBit - 1, curAddress);
 
         // Adjust the highBit value for the next level
         highBit -= m_number_of_bits_per_level[level];
@@ -135,12 +134,12 @@ SparseMemory::exist(const Address& address) const
         if (curTable->count(curAddress) != 0) {
             curTable = (SparseMapType*)(((*curTable)[curAddress]).entry);
         } else {
-            DEBUG_MSG(CACHE_COMP, HighPrio, "Not found");
+            DPRINTF(RubyCache, "Not found\n");
             return false;
         }
     }
 
-    DEBUG_MSG(CACHE_COMP, HighPrio, "Entry found");
+    DPRINTF(RubyCache, "Entry found\n");
     return true;
 }
 
@@ -224,11 +223,10 @@ SparseMemory::recursivelyRemoveLevels(const Address& address,
     curAddress.setAddress(address.bitSelect(curInfo.lowBit,
                                             curInfo.highBit - 1));
 
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
-    DEBUG_EXPR(CACHE_COMP, HighPrio, curInfo.level);
-    DEBUG_EXPR(CACHE_COMP, HighPrio, curInfo.lowBit);
-    DEBUG_EXPR(CACHE_COMP, HighPrio, curInfo.highBit - 1);
-    DEBUG_EXPR(CACHE_COMP, HighPrio, curAddress);
+    DPRINTF(RubyCache, "address: %s, curInfo.level: %d, curInfo.lowBit: %d, "
+            "curInfo.highBit - 1: %d, curAddress: %s\n",
+            address, curInfo.level, curInfo.lowBit,
+            curInfo.highBit - 1, curAddress);
 
     assert(curInfo.curTable->count(curAddress) != 0);
 
@@ -307,7 +305,7 @@ SparseMemory::lookup(const Address& address)
     assert(exist(address));
     assert(address == line_address(address));
 
-    DEBUG_EXPR(CACHE_COMP, HighPrio, address);
+    DPRINTF(RubyCache, "address: %s\n", address);
 
     Address curAddress;
     SparseMapType* curTable = m_map_head;
@@ -327,10 +325,9 @@ SparseMemory::lookup(const Address& address)
         lowBit = highBit - m_number_of_bits_per_level[level];
         curAddress.setAddress(address.bitSelect(lowBit, highBit - 1));
 
-        DEBUG_EXPR(CACHE_COMP, HighPrio, level);
-        DEBUG_EXPR(CACHE_COMP, HighPrio, lowBit);
-        DEBUG_EXPR(CACHE_COMP, HighPrio, highBit - 1);
-        DEBUG_EXPR(CACHE_COMP, HighPrio, curAddress);
+        DPRINTF(RubyCache, "level: %d, lowBit: %d, highBit - 1: %d, "
+                "curAddress: %s\n",
+                level, lowBit, highBit - 1, curAddress);
 
         // Adjust the highBit value for the next level
         highBit -= m_number_of_bits_per_level[level];
diff --git a/src/mem/ruby/tester/RaceyPseudoThread.cc b/src/mem/ruby/tester/RaceyPseudoThread.cc
index 79f6d1550..eaae1112f 100644
--- a/src/mem/ruby/tester/RaceyPseudoThread.cc
+++ b/src/mem/ruby/tester/RaceyPseudoThread.cc
@@ -60,9 +60,7 @@ void RaceyPseudoThread::checkForDeadlock() {
 void RaceyPseudoThread::performCallback(int proc, Address address, uint8_t * data ) {
   assert(proc == m_proc_id);
 
-  DEBUG_EXPR(TESTER_COMP, LowPrio, proc);
-  DEBUG_EXPR(TESTER_COMP, LowPrio, address);
-
+  DPRINTF(RubyTester, "proc: %d, address: %s\n", proc, address);
 
   m_last_progress = m_driver.eventQueue->getTime();
 
-- 
cgit v1.2.3