From ba8362f3d7ab8d8f681f13bec130474e19984920 Mon Sep 17 00:00:00 2001 From: Anna Poon Date: Thu, 27 Aug 2020 13:32:32 -0700 Subject: [PATCH] adding changes without whitespace for merge --- src/dsr/model/dsr-rcache.cc | 30 +++++++++++++-------------- src/dsr/model/dsr-routing.cc | 40 ++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/dsr/model/dsr-rcache.cc b/src/dsr/model/dsr-rcache.cc index cd4465452..adc8f2983 100644 --- a/src/dsr/model/dsr-rcache.cc +++ b/src/dsr/model/dsr-rcache.cc @@ -98,7 +98,7 @@ DsrLinkStab::~DsrLinkStab () void DsrLinkStab::Print ( ) const { - NS_LOG_LOGIC ("LifeTime: " << GetLinkStability ().GetSeconds ()); + NS_LOG_LOGIC ("LifeTime: " << GetLinkStability ().As (Time::S)); } typedef std::list::value_type route_pair; @@ -128,7 +128,7 @@ DsrRouteCacheEntry::Invalidate (Time badLinkLifetime) void DsrRouteCacheEntry::Print (std::ostream & os) const { - os << m_dst << "\t" << (m_expire - Simulator::Now ()).GetSeconds () + os << m_dst << "\t" << (m_expire - Simulator::Now ()).As (Time::S) << "\t"; } @@ -467,7 +467,7 @@ DsrRouteCache::PurgeLinkNode () NS_LOG_FUNCTION (this); for (std::map::iterator i = m_linkCache.begin (); i != m_linkCache.end (); ) { - NS_LOG_DEBUG ("The link stability " << i->second.GetLinkStability ().GetSeconds ()); + NS_LOG_DEBUG ("The link stability " << i->second.GetLinkStability ().As (Time::S)); std::map::iterator itmp = i; if (i->second.GetLinkStability () <= Seconds (0)) { @@ -482,7 +482,7 @@ DsrRouteCache::PurgeLinkNode () /// may need to remove them after verify for (std::map::iterator i = m_nodeCache.begin (); i != m_nodeCache.end (); ) { - NS_LOG_DEBUG ("The node stability " << i->second.GetNodeStability ().GetSeconds ()); + NS_LOG_DEBUG ("The node stability " << i->second.GetNodeStability ().As (Time::S)); std::map::iterator itmp = i; if (i->second.GetNodeStability () <= Seconds (0)) { @@ -518,7 +518,7 @@ DsrRouteCache::IncStability (Ipv4Address node) std::map::const_iterator i = m_nodeCache.find (node); if (i == m_nodeCache.end ()) { - NS_LOG_INFO ("The initial stability " << m_initStability.GetSeconds ()); + NS_LOG_INFO ("The initial stability " << m_initStability.As (Time::S)); DsrNodeStab ns (m_initStability); m_nodeCache[node] = ns; return false; @@ -526,8 +526,8 @@ DsrRouteCache::IncStability (Ipv4Address node) else { /// \todo get rid of the debug here - NS_LOG_INFO ("The node stability " << i->second.GetNodeStability ().GetSeconds ()); - NS_LOG_INFO ("The stability here " << Time (i->second.GetNodeStability () * m_stabilityIncrFactor).GetSeconds ()); + NS_LOG_INFO ("The node stability " << i->second.GetNodeStability ().As (Time::S)); + NS_LOG_INFO ("The stability here " << Time (i->second.GetNodeStability () * m_stabilityIncrFactor).As (Time::S)); DsrNodeStab ns (Time (i->second.GetNodeStability () * m_stabilityIncrFactor)); m_nodeCache[node] = ns; return true; @@ -549,8 +549,8 @@ DsrRouteCache::DecStability (Ipv4Address node) else { /// \todo remove it here - NS_LOG_INFO ("The stability here " << i->second.GetNodeStability ().GetSeconds ()); - NS_LOG_INFO ("The stability here " << Time (i->second.GetNodeStability () / m_stabilityDecrFactor).GetSeconds ()); + NS_LOG_INFO ("The stability here " << i->second.GetNodeStability ().As (Time::S)); + NS_LOG_INFO ("The stability here " << Time (i->second.GetNodeStability () / m_stabilityDecrFactor).As (Time::S)); DsrNodeStab ns (Time (i->second.GetNodeStability () / m_stabilityDecrFactor)); m_nodeCache[node] = ns; return true; @@ -592,7 +592,7 @@ DsrRouteCache::AddRoute_Link (DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Addres } if (stab.GetLinkStability () < m_minLifeTime) { - NS_LOG_LOGIC ("Stability: " << stab.GetLinkStability ().GetSeconds ()); + NS_LOG_LOGIC ("Stability: " << stab.GetLinkStability ().As (Time::S)); /// Set the link stability as the m)minLifeTime, default is 1 second stab.SetLinkStability (m_minLifeTime); } @@ -627,7 +627,7 @@ DsrRouteCache::UseExtends (DsrRouteCacheEntry::IP_VECTOR rt) { m_linkCache[link].SetLinkStability (m_useExtends); /// \todo remove after debug - NS_LOG_INFO ("The time of the link " << m_linkCache[link].GetLinkStability ().GetSeconds ()); + NS_LOG_INFO ("The time of the link " << m_linkCache[link].GetLinkStability ().As (Time::S)); } } else @@ -703,8 +703,8 @@ DsrRouteCache::AddRoute (DsrRouteCacheEntry & rt) // This sort function will sort the route cache entries based on the size of route in each of the // route entries rtVector.sort (CompareRoutesExpire); - NS_LOG_DEBUG ("The first time" << rtVector.front ().GetExpireTime ().GetSeconds () << " The second time " - << rtVector.back ().GetExpireTime ().GetSeconds ()); + NS_LOG_DEBUG ("The first time" << rtVector.front ().GetExpireTime ().As (Time::S) << " The second time " + << rtVector.back ().GetExpireTime ().As (Time::S)); NS_LOG_DEBUG ("The first hop" << rtVector.front ().GetVector ().size () << " The second hop " << rtVector.back ().GetVector ().size ()); m_sortedRoutes.erase (dst); // erase the route entries for dst first @@ -737,8 +737,8 @@ bool DsrRouteCache::FindSameRoute (DsrRouteCacheEntry & rt, std::listGetExpireTime ().GetSeconds ()); + NS_LOG_DEBUG ("The new route expire time " << rt.GetExpireTime ().As (Time::S) + << " the original expire time " << i->GetExpireTime ().As (Time::S)); if (rt.GetExpireTime () > i->GetExpireTime ()) { i->SetExpireTime (rt.GetExpireTime ()); diff --git a/src/dsr/model/dsr-routing.cc b/src/dsr/model/dsr-routing.cc index 0d603c46f..802292c51 100644 --- a/src/dsr/model/dsr-routing.cc +++ b/src/dsr/model/dsr-routing.cc @@ -429,7 +429,7 @@ void DsrRouting::Start () for (uint32_t i = 0; i < m_numPriorityQueues; i++) { // Set the network queue max size and the delay - NS_LOG_INFO ("The network queue size " << m_maxNetworkSize << " and the queue delay " << m_maxNetworkDelay.GetSeconds ()); + NS_LOG_INFO ("The network queue size " << m_maxNetworkSize << " and the queue delay " << m_maxNetworkDelay.As (Time::S)); Ptr queue_i = CreateObject (m_maxNetworkSize,m_maxNetworkDelay); std::pair >::iterator, bool> result_i = m_priorityQueue.insert (std::make_pair (i, queue_i)); NS_ASSERT_MSG (result_i.second, "Error in creating queues"); @@ -830,7 +830,7 @@ void DsrRouting::SendBuffTimerExpire () void DsrRouting::CheckSendBuffer () { - NS_LOG_INFO (Simulator::Now ().GetSeconds () + NS_LOG_INFO (Simulator::Now ().As (Time::S) << " Checking send buffer at " << m_mainAddress << " with size " << m_sendBuffer.GetSize ()); for (std::vector::iterator i = m_sendBuffer.GetBuffer ().begin (); i != m_sendBuffer.GetBuffer ().end (); ) @@ -1123,7 +1123,7 @@ bool DsrRouting::PromiscReceive (Ptr device, Ptr packet { Ipv4Address promiscSource = GetIPfromMAC (Mac48Address::ConvertFrom (from)); dsrOption = GetOption (optionType); // Get the relative DSR option and demux to the process function - NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << + NS_LOG_DEBUG (Simulator::Now ().As (Time::S) << " DSR node " << m_mainAddress << " overhearing packet PID: " << pktMinusIpHdr->GetUid () << " from " << promiscSource << @@ -1154,16 +1154,16 @@ DsrRouting::PacketNewRoute (Ptr packet, // Queue the packet if there is no route pre-existing if (!findRoute) { - NS_LOG_INFO (Simulator::Now ().GetSeconds () - << "s " << m_mainAddress << " there is no route for this packet, queue the packet"); + NS_LOG_INFO (Simulator::Now ().As (Time::S) + << " " << m_mainAddress << " there is no route for this packet, queue the packet"); Ptr p = packet->Copy (); DsrSendBuffEntry newEntry (p, destination, m_sendBufferTimeout, protocol); // Create a new entry for send buffer bool result = m_sendBuffer.Enqueue (newEntry); // Enqueue the packet in send buffer if (result) { - NS_LOG_INFO (Simulator::Now ().GetSeconds () - << "s Add packet PID: " << packet->GetUid () << " to queue. Packet: " << *packet); + NS_LOG_INFO (Simulator::Now ().As (Time::S) + << " Add packet PID: " << packet->GetUid () << " to queue. Packet: " << *packet); NS_LOG_LOGIC ("Send RREQ to" << destination); if ((m_addressReqTimer.find (destination) == m_addressReqTimer.end ()) && (m_nonPropReqTimer.find (destination) == m_nonPropReqTimer.end ())) @@ -1294,8 +1294,8 @@ DsrRouting::SendUnreachError (Ipv4Address unreachNode, Ipv4Address destination, } else { - NS_LOG_INFO (Simulator::Now ().GetSeconds () - << "s " << m_mainAddress << " there is no route for this packet, queue the packet"); + NS_LOG_INFO (Simulator::Now ().As (Time::S) + << " " << m_mainAddress << " there is no route for this packet, queue the packet"); dsrRoutingHeader.SetPayloadLength (rerrLength + 2); dsrRoutingHeader.AddDsrOption (rerrUnreachHeader); @@ -1306,8 +1306,8 @@ DsrRouting::SendUnreachError (Ipv4Address unreachNode, Ipv4Address destination, bool result = m_errorBuffer.Enqueue (newEntry); // Enqueue the packet in send buffer if (result) { - NS_LOG_INFO (Simulator::Now ().GetSeconds () - << "s Add packet PID: " << p->GetUid () << " to queue. Packet: " << *p); + NS_LOG_INFO (Simulator::Now ().As (Time::S) + << " Add packet PID: " << p->GetUid () << " to queue. Packet: " << *p); NS_LOG_LOGIC ("Send RREQ to" << destination); if ((m_addressReqTimer.find (destination) == m_addressReqTimer.end ()) && (m_nonPropReqTimer.find (destination) == m_nonPropReqTimer.end ())) { @@ -1438,16 +1438,16 @@ DsrRouting::Send (Ptr packet, // Queue the packet if there is no route pre-existing if (!findRoute) { - NS_LOG_INFO (Simulator::Now ().GetSeconds () - << "s " << m_mainAddress << " there is no route for this packet, queue the packet"); + NS_LOG_INFO (Simulator::Now ().As (Time::S) + << " " << m_mainAddress << " there is no route for this packet, queue the packet"); Ptr p = packet->Copy (); DsrSendBuffEntry newEntry (p, destination, m_sendBufferTimeout, protocol); // Create a new entry for send buffer bool result = m_sendBuffer.Enqueue (newEntry); // Enqueue the packet in send buffer if (result) { - NS_LOG_INFO (Simulator::Now ().GetSeconds () - << "s Add packet PID: " << packet->GetUid () << " to send buffer. Packet: " << *packet); + NS_LOG_INFO (Simulator::Now ().As (Time::S) + << " Add packet PID: " << packet->GetUid () << " to send buffer. Packet: " << *packet); // Only when there is no existing route request timer when new route request is scheduled if ((m_addressReqTimer.find (destination) == m_addressReqTimer.end ()) && (m_nonPropReqTimer.find (destination) == m_nonPropReqTimer.end ())) { @@ -2471,7 +2471,7 @@ DsrRouting::ScheduleNetworkPacketRetry (DsrMaintainBuffEntry & mb, m_addressForwardTimer[networkKey].Cancel (); m_addressForwardTimer[networkKey].SetArguments (newEntry, protocol); NS_LOG_DEBUG ("The packet retries time for " << newEntry.GetAckId () << " is " << m_sendRetries - << " and the delay time is " << Time (2 * m_nodeTraversalTime).GetSeconds ()); + << " and the delay time is " << Time (2 * m_nodeTraversalTime).As (Time::S)); // Back-off mechanism m_addressForwardTimer[networkKey].Schedule (Time (2 * m_nodeTraversalTime)); } @@ -2519,7 +2519,7 @@ DsrRouting::ScheduleNetworkPacketRetry (DsrMaintainBuffEntry & mb, m_addressForwardTimer[networkKey].Cancel (); m_addressForwardTimer[networkKey].SetArguments (mb, protocol); NS_LOG_DEBUG ("The packet retries time for " << mb.GetAckId () << " is " << m_sendRetries - << " and the delay time is " << Time (2 * m_sendRetries * m_nodeTraversalTime).GetSeconds ()); + << " and the delay time is " << Time (2 * m_sendRetries * m_nodeTraversalTime).As (Time::S)); // Back-off mechanism m_addressForwardTimer[networkKey].Schedule (Time (2 * m_sendRetries * m_nodeTraversalTime)); } @@ -2990,16 +2990,16 @@ DsrRouting::ScheduleRreqRetry (Ptr packet, std::vector addr // This is the first route request retry rreqDelay = m_requestPeriod; } - NS_LOG_LOGIC ("Request count for " << dst << " " << m_rreqTable->GetRreqCnt (dst) << " with delay time " << rreqDelay.GetSeconds () << " second"); + NS_LOG_LOGIC ("Request count for " << dst << " " << m_rreqTable->GetRreqCnt (dst) << " with delay time " << rreqDelay.As (Time::S)); if (rreqDelay > m_maxRequestPeriod) { // use the max request period - NS_LOG_LOGIC ("The max request delay time " << m_maxRequestPeriod.GetSeconds ()); + NS_LOG_LOGIC ("The max request delay time " << m_maxRequestPeriod.As (Time::S)); m_addressReqTimer[dst].Schedule (m_maxRequestPeriod); } else { - NS_LOG_LOGIC ("The request delay time " << rreqDelay.GetSeconds () << " second"); + NS_LOG_LOGIC ("The request delay time " << rreqDelay.As (Time::S)); m_addressReqTimer[dst].Schedule (rreqDelay); } }