Add support for tracing the OLSR routing table size.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu, 14 Feb 2008 18:55:11 +0000
changeset 2333 5966c42cfea3
parent 2332 200875532591
child 2334 1021234da54e
Add support for tracing the OLSR routing table size.
src/routing/olsr/olsr-agent-impl.cc
src/routing/olsr/olsr-agent-impl.h
src/routing/olsr/routing-table.h
--- a/src/routing/olsr/olsr-agent-impl.cc	Thu Feb 14 18:15:26 2008 +0000
+++ b/src/routing/olsr/olsr-agent-impl.cc	Thu Feb 14 18:55:11 2008 +0000
@@ -296,6 +296,11 @@
                                  "const olsr::MessageList &", "list of OLSR messages contained in the packet"
                                  ),
                        m_txPacketTrace);
+  resolver->AddSource ("RoutingTableChanged",
+                       TraceDoc ("the OLSR routing table has changed",
+                                 "uint32_t", "size of the new routing table"
+                                 ),
+                       m_routingTableChanged);
   resolver->SetParentResolver (Object::GetTraceResolver ());
   return resolver;
 }
@@ -970,6 +975,7 @@
     }
 
   NS_LOG_DEBUG ("Node " << m_mainAddress << ": RoutingTableComputation end.");
+  m_routingTableChanged (m_routingTable->GetSize ());
 }
 
 
--- a/src/routing/olsr/olsr-agent-impl.h	Thu Feb 14 18:15:26 2008 +0000
+++ b/src/routing/olsr/olsr-agent-impl.h	Thu Feb 14 18:55:11 2008 +0000
@@ -187,6 +187,7 @@
                        const MessageList &> m_rxPacketTrace;
   CallbackTraceSource <const PacketHeader &,
                        const MessageList &> m_txPacketTrace;
+  CallbackTraceSource <uint32_t> m_routingTableChanged;
 
 };
 
--- a/src/routing/olsr/routing-table.h	Thu Feb 14 18:15:26 2008 +0000
+++ b/src/routing/olsr/routing-table.h	Thu Feb 14 18:55:11 2008 +0000
@@ -81,8 +81,9 @@
   {}
 
   ~RoutingTable () {}
-  
+
   void Clear ();
+  uint32_t GetSize () const { return m_table.size (); }
   void RemoveEntry (const Ipv4Address &dest);
   void AddEntry (const Ipv4Address &dest,
                  const Ipv4Address &next,