src/internet-node/ascii-trace.cc
changeset 1376 ad7e61edfb9d
parent 1362 162bd608c970
parent 1281 9b2b6ead9df6
child 1381 6dd346ffeddc
--- a/src/internet-node/ascii-trace.cc	Tue Aug 28 11:22:01 2007 +0200
+++ b/src/internet-node/ascii-trace.cc	Tue Aug 28 12:05:35 2007 +0200
@@ -25,6 +25,7 @@
 #include "ns3/node.h"
 #include "ns3/node-list.h"
 #include "ns3/packet.h"
+#include "ns3/queue.h"
 
 namespace ns3 {
 
@@ -40,8 +41,12 @@
 AsciiTrace::TraceAllQueues (void)
 {
   Packet::EnableMetadata ();
-  NodeList::Connect ("/nodes/*/devices/*/queue/*",
-                     MakeCallback (&AsciiTrace::LogDevQueue, this));
+  NodeList::Connect ("/nodes/*/devices/*/queue/enqueue",
+                      MakeCallback (&AsciiTrace::LogDevQueueEnqueue, this));
+  NodeList::Connect ("/nodes/*/devices/*/queue/dequeue",
+                      MakeCallback (&AsciiTrace::LogDevQueueDequeue, this));
+  NodeList::Connect ("/nodes/*/devices/*/queue/drop",
+                      MakeCallback (&AsciiTrace::LogDevQueueDrop, this));
 }
 void
 AsciiTrace::TraceAllNetDeviceRx (void)
@@ -52,8 +57,34 @@
 }
 
 void 
-AsciiTrace::LogDevQueue (TraceContext const &context, Packet const &packet)
+AsciiTrace::LogDevQueueEnqueue (TraceContext const &context, 
+  Packet const &packet)
 {
+  m_os << "+ ";
+  m_os << Simulator::Now ().GetSeconds () << " ";
+  context.Print (m_os);
+  m_os << " pkt-uid=" << packet.GetUid () << " ";
+  packet.Print (m_os);
+  m_os << std::endl;
+}
+
+void 
+AsciiTrace::LogDevQueueDequeue (TraceContext const &context, 
+  Packet const &packet)
+{
+  m_os << "- ";
+  m_os << Simulator::Now ().GetSeconds () << " ";
+  context.Print (m_os);
+  m_os << " pkt-uid=" << packet.GetUid () << " ";
+  packet.Print (m_os);
+  m_os << std::endl;
+}
+
+void 
+AsciiTrace::LogDevQueueDrop (TraceContext const &context, 
+  Packet const &packet)
+{
+  m_os << "d ";
   m_os << Simulator::Now ().GetSeconds () << " ";
   context.Print (m_os);
   m_os << " pkt-uid=" << packet.GetUid () << " ";
@@ -63,7 +94,7 @@
 void 
 AsciiTrace::LogDevRx (TraceContext const &context, Packet &p)
 {
-  m_os << Simulator::Now ().GetSeconds () << " ";
+  m_os << "r " << Simulator::Now ().GetSeconds () << " ";
   context.Print (m_os);
   m_os << " pkt-uid=" << p.GetUid () << " ";
   p.Print (m_os);