XML reports simplified for better parsing
authorPavel Boyko <boyko@iitp.ru>
Tue, 30 Jun 2009 18:13:44 +0400
changeset 5098 13ded9ff11c4
parent 5097 f07f268eef67
child 5099 bb2373a0cece
XML reports simplified for better parsing
src/devices/mesh/dot11s/hwmp-protocol-mac.cc
src/devices/mesh/dot11s/hwmp-protocol.cc
src/devices/mesh/dot11s/peer-link.cc
src/devices/mesh/dot11s/peer-management-protocol-mac.cc
src/devices/mesh/dot11s/peer-management-protocol.cc
src/devices/mesh/dot11s/peer-management-protocol.h
src/devices/mesh/mesh-point-device.cc
src/devices/mesh/mesh-wifi-interface-mac.cc
src/helper/mesh-helper.cc
--- a/src/devices/mesh/dot11s/hwmp-protocol-mac.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol-mac.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -334,13 +334,13 @@
     "rxPrep=\"" << rxPrep << "\"\n"
     "rxPerr=\"" << rxPerr << "\"\n"
     "txMgt=\"" << txMgt << "\"\n"
-    "txMgtBytes=\"" << (double)txMgtBytes  / 1024.0 << "K\"\n"
+    "txMgtBytes=\"" << txMgtBytes  << "\"\n"
     "rxMgt=\"" << rxMgt << "\"\n"
-    "rxMgtBytes=\"" << (double)rxMgtBytes / 1204.0 << "K\"\n"
+    "rxMgtBytes=\"" << rxMgtBytes << "\"\n"
     "txData=\"" << txData << "\"\n"
-    "txDataBytes=\"" << (double)txDataBytes / 1024.0 << "K\"\n"
+    "txDataBytes=\"" << txDataBytes << "\"\n"
     "rxData=\"" << rxData << "\"\n"
-    "rxDataBytes=\"" << (double)rxDataBytes / 1024.0 << "K\"/>\n";
+    "rxDataBytes=\"" << rxDataBytes << "\"/>\n";
 }
 void
 HwmpProtocolMac::Report (std::ostream & os) const
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -961,7 +961,7 @@
   os << "<Statistics "
     "txUnicast=\"" << txUnicast << "\" "
     "txBroadcast=\"" << txBroadcast << "\" "
-    "txBytes=\"" << txBytes / 1024 << "K\" "
+    "txBytes=\"" << txBytes << "\" "
     "droppedTtl=\"" << droppedTtl << "\" "
     "totalQueued=\"" << totalQueued << "\" "
     "totalDropped=\"" << totalDropped << "\"/>\n";
@@ -973,13 +973,13 @@
     "address=\"" << m_address << "\"\n"
     "maxQueueSize=\"" << m_maxQueueSize << "\"\n"
     "dot11MeshHWMPmaxPREQretries=\"" << (uint16_t)m_dot11MeshHWMPmaxPREQretries << "\"\n"
-    "dot11MeshHWMPnetDiameterTraversalTime=\"" << m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHWMPpreqMinInterval=\"" << m_dot11MeshHWMPpreqMinInterval.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHWMPperrMinInterval=\"" << m_dot11MeshHWMPperrMinInterval.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHWMPactiveRootTimeout=\"" << m_dot11MeshHWMPactiveRootTimeout.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHWMPactivePathTimeout=\"" << m_dot11MeshHWMPactivePathTimeout.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHWMPpathToRootInterval=\"" << m_dot11MeshHWMPpathToRootInterval.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHWMPrannInterval=\"" << m_dot11MeshHWMPrannInterval.GetMilliSeconds () << "ms\"\n"
+    "dot11MeshHWMPnetDiameterTraversalTime=\"" << m_dot11MeshHWMPnetDiameterTraversalTime.GetSeconds () << "\"\n"
+    "dot11MeshHWMPpreqMinInterval=\"" << m_dot11MeshHWMPpreqMinInterval.GetSeconds () << "\"\n"
+    "dot11MeshHWMPperrMinInterval=\"" << m_dot11MeshHWMPperrMinInterval.GetSeconds () << "\"\n"
+    "dot11MeshHWMPactiveRootTimeout=\"" << m_dot11MeshHWMPactiveRootTimeout.GetSeconds () << "\"\n"
+    "dot11MeshHWMPactivePathTimeout=\"" << m_dot11MeshHWMPactivePathTimeout.GetSeconds () << "\"\n"
+    "dot11MeshHWMPpathToRootInterval=\"" << m_dot11MeshHWMPpathToRootInterval.GetSeconds () << "\"\n"
+    "dot11MeshHWMPrannInterval=\"" << m_dot11MeshHWMPrannInterval.GetSeconds () << "\"\n"
     "isRoot=\"" << m_isRoot << "\"\n"
     "maxTtl=\"" << (uint16_t)m_maxTtl << "\"\n"
     "unicastPerrThreshold=\"" << (uint16_t)m_unicastPerrThreshold << "\"\n"
--- a/src/devices/mesh/dot11s/peer-link.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -602,15 +602,11 @@
     "localAddress=\"" << m_macPlugin->GetAddress () << "\"\n"
     "peerInterfaceAddress=\"" << m_peerAddress << "\"\n"
     "peerMeshPointAddress=\"" << m_peerMeshPointAddress << "\"\n"
-    "metricOfTheLink=\"" << m_macPlugin->GetLinkMetric(m_peerAddress) << "\"\n"
-    "lastBeacon=\"" << m_lastBeacon.GetMilliSeconds () << "ms\"\n"
+    "metric=\"" << m_macPlugin->GetLinkMetric(m_peerAddress) << "\"\n"
+    "lastBeacon=\"" << m_lastBeacon.GetSeconds () << "\"\n"
     "localLinkId=\"" << m_localLinkId << "\"\n"
     "peerLinkId=\"" << m_peerLinkId << "\"\n"
     "assocId=\"" << m_assocId << "\"\n"
-    "dot11MeshMaxRetries=\"" << m_dot11MeshMaxRetries << "\"\n"
-    "dot11MeshRetryTimeout=\"" << m_dot11MeshRetryTimeout.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshHoldingTimeout=\"" << m_dot11MeshHoldingTimeout.GetMilliSeconds () << "ms\"\n"
-    "dot11MeshConfirmTimeout=\"" << m_dot11MeshConfirmTimeout.GetMilliSeconds () << "ms\"\n"
     "/>\n";
 }
 } // namespace dot11s
--- a/src/devices/mesh/dot11s/peer-management-protocol-mac.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -289,9 +289,9 @@
     "dropped=\"" << dropped << "\"\n"
     "brokenMgt=\"" << brokenMgt << "\"\n"
     "txMgt=\"" << txMgt << "\"\n"
-    "txMgtBytes=\"" << (double)txMgtBytes /1024.0 << "\"\n"
+    "txMgtBytes=\"" << txMgtBytes << "\"\n"
     "rxMgt=\"" << rxMgt << "\"\n"
-    "rxMgtBytes=\"" << (double)rxMgtBytes / 1024.0 << "K\"\n"
+    "rxMgtBytes=\"" << rxMgtBytes << "\"\n"
     "beaconShift=\"" << beaconShift << "\"/>\n";
 }
 void
--- a/src/devices/mesh/dot11s/peer-management-protocol.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -61,8 +61,7 @@
 }
 PeerManagementProtocol::PeerManagementProtocol ():
   m_lastAssocId (0),
-  m_lastLocalLinkId (1),
-  m_numberOfActivePeers (0)
+  m_lastLocalLinkId (1)
   {
   }
 PeerManagementProtocol::~PeerManagementProtocol ()
@@ -345,9 +344,7 @@
 bool
 PeerManagementProtocol::ShouldSendOpen (uint32_t interface, Mac48Address peerAddress)
 {
-  if (m_numberOfActivePeers > m_maxNumberOfPeerLinks)
-    return false;
-  return true;
+  return (m_stats.linksTotal <= m_maxNumberOfPeerLinks);
 }
 bool
 PeerManagementProtocol::ShouldAcceptOpen (
@@ -355,7 +352,7 @@
     Mac48Address peerAddress,
     PmpReasonCode & reasonCode)
 {
-  if (m_numberOfActivePeers > m_maxNumberOfPeerLinks)
+  if (m_stats.linksTotal > m_maxNumberOfPeerLinks)
     {
       reasonCode = REASON11S_MESH_MAX_PEERS;
       return false;
@@ -428,14 +425,14 @@
   if((nstate == PeerLink::ESTAB) && (ostate != PeerLink::ESTAB))
     {
       m_stats.linksOpened ++;
-      m_numberOfActivePeers ++;
+      m_stats.linksTotal++;
       if(!m_peerStatusCallback.IsNull ())
         m_peerStatusCallback (peerMeshPointAddress, peerAddress, interface, true);
     }
   if((ostate == PeerLink::ESTAB) && (nstate != PeerLink::ESTAB))
     {
       m_stats.linksClosed ++;
-      m_numberOfActivePeers --;
+      m_stats.linksTotal--;
       if(!m_peerStatusCallback.IsNull ())
         m_peerStatusCallback (peerMeshPointAddress, peerAddress, interface, false);
     }
@@ -448,7 +445,7 @@
 uint8_t
 PeerManagementProtocol::GetNumberOfLinks ()
 {
-  return m_numberOfActivePeers;
+  return m_stats.linksTotal;
 }
 Ptr<IeMeshId>
 PeerManagementProtocol::GetMeshId () const
@@ -470,6 +467,7 @@
 PeerManagementProtocol::Statistics::Print (std::ostream & os) const
 {
   os << "<Statistics "
+  "linksTotal=\""  << linksTotal <<  "\" " 
   "linksOpened=\"" << linksOpened << "\" "
   "linksClosed=\"" << linksClosed << "\"/>\n";
 }
@@ -493,7 +491,7 @@
 void
 PeerManagementProtocol::ResetStats ()
 {
-  m_stats = Statistics::Statistics ();
+  m_stats = Statistics::Statistics (m_stats.linksTotal); // don't reset number of links
   for(PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins ++)
     plugins->second->ResetStats ();
 }
--- a/src/devices/mesh/dot11s/peer-management-protocol.h	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol.h	Tue Jun 30 18:13:44 2009 +0400
@@ -212,7 +212,6 @@
   ///\}
   uint16_t m_lastAssocId;
   uint16_t m_lastLocalLinkId;
-  uint8_t m_numberOfActivePeers; //number of established peer links
   uint8_t m_maxNumberOfPeerLinks;
   /**
    * Peer Links
@@ -232,10 +231,11 @@
   ///\}
   //Keeps statistics
   struct Statistics {
+    uint16_t linksTotal;
     uint16_t linksOpened;
     uint16_t linksClosed;
 
-    Statistics () : linksOpened (0), linksClosed (0) {};
+    Statistics (uint16_t t = 0) : linksTotal(t), linksOpened (0), linksClosed (0) {};
     void Print (std::ostream & os) const;
   };
   struct Statistics m_stats;
--- a/src/devices/mesh/mesh-point-device.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/mesh-point-device.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -424,17 +424,17 @@
 {
   os << "<Statistics \n"
       "txUnicastData=\"" << m_txStats.unicastData  << "\"\n"
-      "txUnicastDataBytes=\"" << (double)m_txStats.unicastDataBytes / 1024 << "K\"\n"
+      "txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"\n"
       "txBroadcastData=\"" << m_txStats.broadcastData  << "\"\n"
-      "txBroadcastDataBytes=\"" << (double)m_txStats.broadcastDataBytes / 1024  << "K\"\n"
+      "txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"\n"
       "rxUnicastData=\"" << m_rxStats.unicastData  << "\"\n"
-      "rxUnicastDataBytes=\"" << (double)m_rxStats.unicastDataBytes / 1024 << "K\"\n"
+      "rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"\n"
       "rxBroadcastData=\"" << m_rxStats.broadcastData  << "\"\n"
-      "rxBroadcastDataBytes=\"" << (double)m_rxStats.broadcastDataBytes / 1024  << "K\"\n"
+      "rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"\n"
       "fwdUnicastData=\"" << m_fwdStats.unicastData  << "\"\n"
-      "fwdUnicastDataBytes=\"" << (double)m_fwdStats.unicastDataBytes / 1024 << "K\"\n"
+      "fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"\n"
       "fwdBroadcastData=\"" << m_fwdStats.broadcastData  << "\"\n"
-      "fwdBroadcastDataBytes=\"" << (double)m_fwdStats.broadcastDataBytes / 1024  << "K\"\n"
+      "fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"\n"
       "/>\n";
 }
 
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -648,17 +648,18 @@
 MeshWifiInterfaceMac::Statistics::Print (std::ostream & os) const
 {
   os << "<Statistics "
+    // TODO txBeacons
     "rxBeacons=\"" << recvBeacons << "\" "
     "txFrames=\"" << sentFrames << "\" "
-    "txBytes=\"" << (double)sentBytes / 1024.0 << "K\" "
+    "txBytes=\"" << sentBytes << "\" "
     "rxFrames=\"" << recvFrames << "\" "
-    "rxBytes=\"" << (double)recvBytes / 1024.0 << "K\"/>\n";
+    "rxBytes=\"" << recvBytes << "\"/>\n";
 }
 void
 MeshWifiInterfaceMac::Report (std::ostream & os) const
 {
   os << "<Interface "
-    "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds() << "s\" "
+    "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds() << "\" "
     "Channel=\"" << GetFrequencyChannel () << "\" "
     "Address = \"" << GetAddress () << "\">\n";
   m_stats.Print (os);
--- a/src/helper/mesh-helper.cc	Mon Jun 22 21:18:44 2009 +0400
+++ b/src/helper/mesh-helper.cc	Tue Jun 30 18:13:44 2009 +0400
@@ -89,7 +89,7 @@
   Ptr <MeshPointDevice> mp = device->GetObject<MeshPointDevice> ();
   NS_ASSERT (mp != 0);
   std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
-  os << "<MeshPointDevice ReportTime=\"" << Simulator::Now().GetSeconds() << "s\" MpAddress=\"" << mp->GetAddress () << "\">\n";
+  os << "<MeshPointDevice time=\"" << Simulator::Now().GetSeconds() << "\" address=\"" << Mac48Address::ConvertFrom(mp->GetAddress ()) << "\">\n";
   m_stack->Report (mp, os);
   os << "</MeshPointDevice>\n";
 }