LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 { | 109 { |
110 m_wifiPhyCountersStopTime = stopTime; | 110 m_wifiPhyCountersStopTime = stopTime; |
111 m_wifiPhyCountersPollInterval = pollInterval; | 111 m_wifiPhyCountersPollInterval = pollInterval; |
112 m_wifiPhyTxDropCounterId = AddNodeCounter ("WifiPhy TxDrop", AnimationInterfac
e::DOUBLE_COUNTER); | 112 m_wifiPhyTxDropCounterId = AddNodeCounter ("WifiPhy TxDrop", AnimationInterfac
e::DOUBLE_COUNTER); |
113 m_wifiPhyRxDropCounterId = AddNodeCounter ("WifiPhy RxDrop", AnimationInterfac
e::DOUBLE_COUNTER); | 113 m_wifiPhyRxDropCounterId = AddNodeCounter ("WifiPhy RxDrop", AnimationInterfac
e::DOUBLE_COUNTER); |
114 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) | 114 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
115 { | 115 { |
116 Ptr<Node> n = *i; | 116 Ptr<Node> n = *i; |
117 m_nodeWifiPhyTxDrop[n->GetId ()] = 0; | 117 m_nodeWifiPhyTxDrop[n->GetId ()] = 0; |
118 m_nodeWifiPhyRxDrop[n->GetId ()] = 0; | 118 m_nodeWifiPhyRxDrop[n->GetId ()] = 0; |
119 UpdateNodeCounter (m_wifiPhyTxDropCounterId, n->GetId (), 0.0); | 119 UpdateNodeCounter (m_wifiPhyTxDropCounterId, n->GetId (), 0); |
120 UpdateNodeCounter (m_wifiPhyRxDropCounterId, n->GetId (), 0.0); | 120 UpdateNodeCounter (m_wifiPhyRxDropCounterId, n->GetId (), 0); |
121 } | 121 } |
122 Simulator::Schedule (startTime, &AnimationInterface::TrackWifiPhyCounters, thi
s); | 122 Simulator::Schedule (startTime, &AnimationInterface::TrackWifiPhyCounters, thi
s); |
123 · | 123 · |
124 } | 124 } |
125 | 125 |
126 void | 126 void |
127 AnimationInterface::EnableWifiMacCounters (Time startTime, Time stopTime, Time p
ollInterval) | 127 AnimationInterface::EnableWifiMacCounters (Time startTime, Time stopTime, Time p
ollInterval) |
128 { | 128 { |
129 m_wifiMacCountersStopTime = stopTime; | 129 m_wifiMacCountersStopTime = stopTime; |
130 m_wifiMacCountersPollInterval = pollInterval; | 130 m_wifiMacCountersPollInterval = pollInterval; |
131 m_wifiMacTxCounterId = AddNodeCounter ("WifiMac Tx", AnimationInterface::DOUBL
E_COUNTER); | 131 m_wifiMacTxCounterId = AddNodeCounter ("WifiMac Tx", AnimationInterface::DOUBL
E_COUNTER); |
132 m_wifiMacTxDropCounterId = AddNodeCounter ("WifiMac TxDrop", AnimationInterfac
e::DOUBLE_COUNTER); | 132 m_wifiMacTxDropCounterId = AddNodeCounter ("WifiMac TxDrop", AnimationInterfac
e::DOUBLE_COUNTER); |
133 m_wifiMacRxCounterId = AddNodeCounter ("WifiMac Rx", AnimationInterface::DOUBL
E_COUNTER); | 133 m_wifiMacRxCounterId = AddNodeCounter ("WifiMac Rx", AnimationInterface::DOUBL
E_COUNTER); |
134 m_wifiMacRxDropCounterId = AddNodeCounter ("WifiMac RxDrop", AnimationInterfac
e::DOUBLE_COUNTER); | 134 m_wifiMacRxDropCounterId = AddNodeCounter ("WifiMac RxDrop", AnimationInterfac
e::DOUBLE_COUNTER); |
135 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) | 135 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
136 { | 136 { |
137 Ptr<Node> n = *i; | 137 Ptr<Node> n = *i; |
138 m_nodeWifiMacTx[n->GetId ()] = 0; | 138 m_nodeWifiMacTx[n->GetId ()] = 0; |
139 m_nodeWifiMacTxDrop[n->GetId ()] = 0; | 139 m_nodeWifiMacTxDrop[n->GetId ()] = 0; |
140 m_nodeWifiMacRx[n->GetId ()] = 0; | 140 m_nodeWifiMacRx[n->GetId ()] = 0; |
141 m_nodeWifiMacRxDrop[n->GetId ()] = 0; | 141 m_nodeWifiMacRxDrop[n->GetId ()] = 0; |
142 UpdateNodeCounter (m_wifiMacTxCounterId, n->GetId (), 0.0); | 142 UpdateNodeCounter (m_wifiMacTxCounterId, n->GetId (), 0); |
143 UpdateNodeCounter (m_wifiMacTxDropCounterId, n->GetId (), 0.0); | 143 UpdateNodeCounter (m_wifiMacTxDropCounterId, n->GetId (), 0); |
144 UpdateNodeCounter (m_wifiMacRxCounterId, n->GetId (), 0.0); | 144 UpdateNodeCounter (m_wifiMacRxCounterId, n->GetId (), 0); |
145 UpdateNodeCounter (m_wifiMacRxDropCounterId, n->GetId (), 0.0); | 145 UpdateNodeCounter (m_wifiMacRxDropCounterId, n->GetId (), 0); |
146 } | 146 } |
147 Simulator::Schedule (startTime, &AnimationInterface::TrackWifiMacCounters, thi
s); | 147 Simulator::Schedule (startTime, &AnimationInterface::TrackWifiMacCounters, thi
s); |
148 } | 148 } |
149 | 149 |
150 void | 150 void |
151 AnimationInterface::EnableQueueCounters (Time startTime, Time stopTime, Time pol
lInterval) | 151 AnimationInterface::EnableQueueCounters (Time startTime, Time stopTime, Time pol
lInterval) |
152 { | 152 { |
153 m_queueCountersStopTime = stopTime; | 153 m_queueCountersStopTime = stopTime; |
154 m_queueCountersPollInterval = pollInterval; | 154 m_queueCountersPollInterval = pollInterval; |
155 m_queueEnqueueCounterId = AddNodeCounter ("Enqueue", AnimationInterface::DOUBL
E_COUNTER); | 155 m_queueEnqueueCounterId = AddNodeCounter ("Enqueue", AnimationInterface::DOUBL
E_COUNTER); |
156 m_queueDequeueCounterId = AddNodeCounter ("Dequeue", AnimationInterface::DOUBL
E_COUNTER); | 156 m_queueDequeueCounterId = AddNodeCounter ("Dequeue", AnimationInterface::DOUBL
E_COUNTER); |
157 m_queueDropCounterId = AddNodeCounter ("Queue Drop", AnimationInterface::DOUBL
E_COUNTER); | 157 m_queueDropCounterId = AddNodeCounter ("Queue Drop", AnimationInterface::DOUBL
E_COUNTER); |
158 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) | 158 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
159 { | 159 { |
160 Ptr<Node> n = *i; | 160 Ptr<Node> n = *i; |
161 m_nodeQueueEnqueue[n->GetId ()] = 0; | 161 m_nodeQueueEnqueue[n->GetId ()] = 0; |
162 m_nodeQueueDequeue[n->GetId ()] = 0; | 162 m_nodeQueueDequeue[n->GetId ()] = 0; |
163 m_nodeQueueDrop[n->GetId ()] = 0; | 163 m_nodeQueueDrop[n->GetId ()] = 0; |
164 UpdateNodeCounter (m_queueEnqueueCounterId, n->GetId (), 0.0); | 164 UpdateNodeCounter (m_queueEnqueueCounterId, n->GetId (), 0); |
165 UpdateNodeCounter (m_queueDequeueCounterId, n->GetId (), 0.0); | 165 UpdateNodeCounter (m_queueDequeueCounterId, n->GetId (), 0); |
166 UpdateNodeCounter (m_queueDropCounterId, n->GetId (), 0.0); | 166 UpdateNodeCounter (m_queueDropCounterId, n->GetId (), 0); |
167 } | 167 } |
168 Simulator::Schedule (startTime, &AnimationInterface::TrackQueueCounters, this)
; | 168 Simulator::Schedule (startTime, &AnimationInterface::TrackQueueCounters, this)
; |
169 } | 169 } |
170 | 170 |
171 void | 171 void |
172 AnimationInterface::EnableIpv4L3ProtocolCounters (Time startTime, Time stopTime,
Time pollInterval) | 172 AnimationInterface::EnableIpv4L3ProtocolCounters (Time startTime, Time stopTime,
Time pollInterval) |
173 { | 173 { |
174 m_ipv4L3ProtocolCountersStopTime = stopTime; | 174 m_ipv4L3ProtocolCountersStopTime = stopTime; |
175 m_ipv4L3ProtocolCountersPollInterval = pollInterval; | 175 m_ipv4L3ProtocolCountersPollInterval = pollInterval; |
176 m_ipv4L3ProtocolTxCounterId = AddNodeCounter ("Ipv4 Tx", AnimationInterface::D
OUBLE_COUNTER); | 176 m_ipv4L3ProtocolTxCounterId = AddNodeCounter ("Ipv4 Tx", AnimationInterface::D
OUBLE_COUNTER); |
177 m_ipv4L3ProtocolRxCounterId = AddNodeCounter ("Ipv4 Rx", AnimationInterface::D
OUBLE_COUNTER); | 177 m_ipv4L3ProtocolRxCounterId = AddNodeCounter ("Ipv4 Rx", AnimationInterface::D
OUBLE_COUNTER); |
178 m_ipv4L3ProtocolDropCounterId = AddNodeCounter ("Ipv4 Drop", AnimationInterfac
e::DOUBLE_COUNTER); | 178 m_ipv4L3ProtocolDropCounterId = AddNodeCounter ("Ipv4 Drop", AnimationInterfac
e::DOUBLE_COUNTER); |
179 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) | 179 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
180 { | 180 { |
181 Ptr<Node> n = *i; | 181 Ptr<Node> n = *i; |
182 m_nodeIpv4Tx[n->GetId ()] = 0; | 182 m_nodeIpv4Tx[n->GetId ()] = 0; |
183 m_nodeIpv4Rx[n->GetId ()] = 0; | 183 m_nodeIpv4Rx[n->GetId ()] = 0; |
184 m_nodeIpv4Drop[n->GetId ()] = 0; | 184 m_nodeIpv4Drop[n->GetId ()] = 0; |
185 UpdateNodeCounter (m_ipv4L3ProtocolTxCounterId, n->GetId (), 0.0); | 185 UpdateNodeCounter (m_ipv4L3ProtocolTxCounterId, n->GetId (), 0); |
186 UpdateNodeCounter (m_ipv4L3ProtocolRxCounterId, n->GetId (), 0.0); | 186 UpdateNodeCounter (m_ipv4L3ProtocolRxCounterId, n->GetId (), 0); |
187 UpdateNodeCounter (m_ipv4L3ProtocolDropCounterId, n->GetId (), 0.0); | 187 UpdateNodeCounter (m_ipv4L3ProtocolDropCounterId, n->GetId (), 0); |
188 } | 188 } |
189 Simulator::Schedule (startTime, &AnimationInterface::TrackIpv4L3ProtocolCounte
rs, this); | 189 Simulator::Schedule (startTime, &AnimationInterface::TrackIpv4L3ProtocolCounte
rs, this); |
190 } | 190 } |
191 | 191 |
192 AnimationInterface &· | 192 AnimationInterface &· |
193 AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTim
e, Time stopTime, Time pollInterval) | 193 AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTim
e, Time stopTime, Time pollInterval) |
194 { | 194 { |
195 SetOutputFile (fileName, true); | 195 SetOutputFile (fileName, true); |
196 m_routingStopTime = stopTime; | 196 m_routingStopTime = stopTime; |
197 m_routingPollInterval = pollInterval; | 197 m_routingPollInterval = pollInterval; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void· | 230 void· |
231 AnimationInterface::SetMaxPktsPerTraceFile (uint64_t maxPacketsPerFile) | 231 AnimationInterface::SetMaxPktsPerTraceFile (uint64_t maxPacketsPerFile) |
232 { | 232 { |
233 m_maxPktsPerFile = maxPacketsPerFile; | 233 m_maxPktsPerFile = maxPacketsPerFile; |
234 } | 234 } |
235 | 235 |
236 uint32_t· | 236 uint32_t· |
237 AnimationInterface::AddNodeCounter (std::string counterName, CounterType counter
Type) | 237 AnimationInterface::AddNodeCounter (std::string counterName, CounterType counter
Type) |
238 { | 238 { |
239 m_nodeCounters.push_back (counterName); | 239 m_nodeCounters.push_back (counterName); |
240 uint32_t counterId = static_cast<uint32_t>(m_nodeCounters.size () - 1); // cou
nter ID is zero-indexed | 240 uint32_t counterId = static_cast<uint32_t> (m_nodeCounters.size () - 1); // co
unter ID is zero-indexed |
241 WriteXmlAddNodeCounter (counterId, counterName, counterType); | 241 WriteXmlAddNodeCounter (counterId, counterName, counterType); |
242 return counterId;· | 242 return counterId;· |
243 } | 243 } |
244 | 244 |
245 uint32_t· | 245 uint32_t· |
246 AnimationInterface::AddResource (std::string resourcePath) | 246 AnimationInterface::AddResource (std::string resourcePath) |
247 { | 247 { |
248 m_resources.push_back (resourcePath); | 248 m_resources.push_back (resourcePath); |
249 uint32_t resourceId = static_cast<uint32_t>(m_resources.size () - 1); // reso
urce ID is zero-indexed | 249 uint32_t resourceId = static_cast<uint32_t> (m_resources.size () - 1); // res
ource ID is zero-indexed |
250 WriteXmlAddResource (resourceId, resourcePath); | 250 WriteXmlAddResource (resourceId, resourcePath); |
251 return resourceId;· | 251 return resourceId;· |
252 } | 252 } |
253 | 253 |
254 void· | 254 void· |
255 AnimationInterface::EnablePacketMetadata (bool enable) | 255 AnimationInterface::EnablePacketMetadata (bool enable) |
256 { | 256 { |
257 m_enablePacketMetadata = enable; | 257 m_enablePacketMetadata = enable; |
258 if (enable) | 258 if (enable) |
259 { | 259 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 if (nodeCounterId > (m_nodeCounters.size () - 1)) | 325 if (nodeCounterId > (m_nodeCounters.size () - 1)) |
326 { | 326 { |
327 NS_FATAL_ERROR ("NodeCounter Id:" << nodeCounterId << " not found. Did you
use AddNodeCounter?"); | 327 NS_FATAL_ERROR ("NodeCounter Id:" << nodeCounterId << " not found. Did you
use AddNodeCounter?"); |
328 } | 328 } |
329 WriteXmlUpdateNodeCounter (nodeCounterId, nodeId, counter); | 329 WriteXmlUpdateNodeCounter (nodeCounterId, nodeId, counter); |
330 } | 330 } |
331 | 331 |
332 void | 332 void |
333 AnimationInterface::UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, u
int64_t counter) | 333 AnimationInterface::UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, u
int64_t counter) |
334 { | 334 { |
335 UpdateNodeCounter(nodeCounterId, nodeId, static_cast<double>(counter)); | 335 UpdateNodeCounter(nodeCounterId, nodeId, static_cast<double> (counter)); |
336 } | 336 } |
337 | 337 |
338 void | 338 void |
339 AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y
, double scaleX, double scaleY, double opacity) | 339 AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y
, double scaleX, double scaleY, double opacity) |
340 { | 340 { |
341 if ((opacity < 0) || (opacity > 1)) | 341 if ((opacity < 0) || (opacity > 1)) |
342 { | 342 { |
343 NS_FATAL_ERROR ("Opacity must be between 0.0 and 1.0"); | 343 NS_FATAL_ERROR ("Opacity must be between 0.0 and 1.0"); |
344 } | 344 } |
345 WriteXmlUpdateBackground (fileName, x, y, scaleX, scaleY, opacity); | 345 WriteXmlUpdateBackground (fileName, x, y, scaleX, scaleY, opacity); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 AnimationInterface::WriteN (const std::string& st, FILE * f) | 505 AnimationInterface::WriteN (const std::string& st, FILE * f) |
506 { | 506 { |
507 if (!f) | 507 if (!f) |
508 { | 508 { |
509 return 0; | 509 return 0; |
510 } | 510 } |
511 if (m_writeCallback) | 511 if (m_writeCallback) |
512 { | 512 { |
513 m_writeCallback (st.c_str ()); | 513 m_writeCallback (st.c_str ()); |
514 } | 514 } |
515 return WriteN (st.c_str (), static_cast<uint32_t>(st.length ()), f); | 515 return WriteN (st.c_str (), static_cast<uint32_t> (st.length ()), f); |
516 } | 516 } |
517 | 517 |
518 int· | 518 int· |
519 AnimationInterface::WriteN (const char* data, uint32_t count, FILE * f) | 519 AnimationInterface::WriteN (const char* data, uint32_t count, FILE * f) |
520 {· | 520 {· |
521 if (!f) | 521 if (!f) |
522 { | 522 { |
523 return 0; | 523 return 0; |
524 } | 524 } |
525 // Write count bytes to h from data | 525 // Write count bytes to h from data |
526 uint32_t nLeft = count; | 526 uint32_t nLeft = count; |
527 const char* p = data; | 527 const char* p = data; |
528 uint32_t written = 0; | 528 uint32_t written = 0; |
529 while (nLeft) | 529 while (nLeft) |
530 { | 530 { |
531 int n = static_cast<uint32_t>(std::fwrite (p, 1, nLeft, f)); | 531 int n = static_cast<uint32_t> (std::fwrite (p, 1, nLeft, f)); |
532 if (n <= 0)· | 532 if (n <= 0)· |
533 { | 533 { |
534 return written; | 534 return written; |
535 } | 535 } |
536 written += n; | 536 written += n; |
537 nLeft -= n; | 537 nLeft -= n; |
538 p += n; | 538 p += n; |
539 } | 539 } |
540 return written; | 540 return written; |
541 } | 541 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 AnimationInterface::AddByteTag (uint64_t animUid, Ptr<const Packet> p) | 635 AnimationInterface::AddByteTag (uint64_t animUid, Ptr<const Packet> p) |
636 { | 636 { |
637 AnimByteTag tag; | 637 AnimByteTag tag; |
638 tag.Set (animUid); | 638 tag.Set (animUid); |
639 p->AddByteTag (tag); | 639 p->AddByteTag (tag); |
640 } | 640 } |
641 | 641 |
642 void· | 642 void· |
643 AnimationInterface::RemainingEnergyTrace (std::string context, double previousEn
ergy, double currentEnergy) | 643 AnimationInterface::RemainingEnergyTrace (std::string context, double previousEn
ergy, double currentEnergy) |
644 { | 644 { |
645 NS_UNUSED(previousEnergy); | 645 NS_UNUSED (previousEnergy); |
646 CHECK_STARTED_INTIMEWINDOW; | 646 CHECK_STARTED_INTIMEWINDOW; |
647 const Ptr <const Node> node = GetNodeFromContext (context); | 647 const Ptr <const Node> node = GetNodeFromContext (context); |
648 const uint32_t nodeId = node->GetId (); | 648 const uint32_t nodeId = node->GetId (); |
649 | 649 |
650 NS_LOG_INFO ("Remaining energy on one of sources on node " << nodeId << ": " <
< currentEnergy); | 650 NS_LOG_INFO ("Remaining energy on one of sources on node " << nodeId << ": " <
< currentEnergy); |
651 | 651 |
652 const Ptr<EnergySource> energySource = node->GetObject<EnergySource> (); | 652 const Ptr<EnergySource> energySource = node->GetObject<EnergySource> (); |
653 | 653 |
654 NS_ASSERT (energySource); | 654 NS_ASSERT (energySource); |
655 // Don't call GetEnergyFraction () because of recursion | 655 // Don't call GetEnergyFraction () because of recursion |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 void | 727 void |
728 AnimationInterface::LrWpanMacRxDropTrace (std::string context, Ptr<const Packet>
p) | 728 AnimationInterface::LrWpanMacRxDropTrace (std::string context, Ptr<const Packet>
p) |
729 { | 729 { |
730 const Ptr <const Node> node = GetNodeFromContext (context); | 730 const Ptr <const Node> node = GetNodeFromContext (context); |
731 ++m_nodeLrWpanMacRxDrop[node->GetId ()]; | 731 ++m_nodeLrWpanMacRxDrop[node->GetId ()]; |
732 } | 732 } |
733 | 733 |
734 void | 734 void |
735 AnimationInterface::Ipv4TxTrace (std::string context, Ptr<const Packet> p, Ptr<I
pv4> ipv4, uint32_t interfaceIndex) | 735 AnimationInterface::Ipv4TxTrace (std::string context, Ptr<const Packet> p, Ptr<I
pv4> ipv4, uint32_t interfaceIndex) |
736 { | 736 { |
737 NS_UNUSED(interfaceIndex); | 737 NS_UNUSED (interfaceIndex); |
738 const Ptr <const Node> node = GetNodeFromContext (context); | 738 const Ptr <const Node> node = GetNodeFromContext (context); |
739 ++m_nodeIpv4Tx[node->GetId ()]; | 739 ++m_nodeIpv4Tx[node->GetId ()]; |
740 } | 740 } |
741 · | 741 · |
742 void | 742 void |
743 AnimationInterface::Ipv4RxTrace (std::string context, Ptr<const Packet> p, Ptr<I
pv4> ipv4, uint32_t interfaceIndex) | 743 AnimationInterface::Ipv4RxTrace (std::string context, Ptr<const Packet> p, Ptr<I
pv4> ipv4, uint32_t interfaceIndex) |
744 { | 744 { |
745 NS_UNUSED(interfaceIndex); | 745 NS_UNUSED (interfaceIndex); |
746 const Ptr <const Node> node = GetNodeFromContext (context); | 746 const Ptr <const Node> node = GetNodeFromContext (context); |
747 ++m_nodeIpv4Rx[node->GetId ()]; | 747 ++m_nodeIpv4Rx[node->GetId ()]; |
748 } | 748 } |
749 | 749 |
750 void | 750 void |
751 AnimationInterface::Ipv4DropTrace (std::string context,· | 751 AnimationInterface::Ipv4DropTrace (std::string context,· |
752 const Ipv4Header & ipv4Header,· | 752 const Ipv4Header & ipv4Header,· |
753 Ptr<const Packet> p,· | 753 Ptr<const Packet> p,· |
754 Ipv4L3Protocol::DropReason dropReason,· | 754 Ipv4L3Protocol::DropReason dropReason,· |
755 Ptr<Ipv4> ipv4,· | 755 Ptr<Ipv4> ipv4,· |
756 uint32_t) | 756 uint32_t) |
757 { | 757 { |
758 NS_UNUSED(ipv4Header); | 758 NS_UNUSED (ipv4Header); |
759 NS_UNUSED(dropReason); | 759 NS_UNUSED (dropReason); |
760 const Ptr <const Node> node = GetNodeFromContext (context); | 760 const Ptr <const Node> node = GetNodeFromContext (context); |
761 ++m_nodeIpv4Drop[node->GetId ()]; | 761 ++m_nodeIpv4Drop[node->GetId ()]; |
762 } | 762 } |
763 | 763 |
764 void | 764 void |
765 AnimationInterface::EnqueueTrace (std::string context, | 765 AnimationInterface::EnqueueTrace (std::string context, |
766 Ptr<const Packet> p) | 766 Ptr<const Packet> p) |
767 { | 767 { |
768 const Ptr <const Node> node = GetNodeFromContext (context); | 768 const Ptr <const Node> node = GetNodeFromContext (context); |
769 ++m_nodeQueueEnqueue[node->GetId ()]; | 769 ++m_nodeQueueEnqueue[node->GetId ()]; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1045 } |
1046 /// \todo NS_ASSERT (WavePacketIsPending (animUid) == true); | 1046 /// \todo NS_ASSERT (WavePacketIsPending (animUid) == true); |
1047 m_pendingWavePackets[animUid].ProcessRxBegin (ndev, Simulator::Now ().GetSecon
ds ()); | 1047 m_pendingWavePackets[animUid].ProcessRxBegin (ndev, Simulator::Now ().GetSecon
ds ()); |
1048 OutputWirelessPacketRxInfo (p, m_pendingWavePackets[animUid], animUid); | 1048 OutputWirelessPacketRxInfo (p, m_pendingWavePackets[animUid], animUid); |
1049 } | 1049 } |
1050 | 1050 |
1051 | 1051 |
1052 void | 1052 void |
1053 AnimationInterface::WimaxTxTrace (std::string context, Ptr<const Packet> p, cons
t Mac48Address & m) | 1053 AnimationInterface::WimaxTxTrace (std::string context, Ptr<const Packet> p, cons
t Mac48Address & m) |
1054 { | 1054 { |
1055 NS_UNUSED(m); | 1055 NS_UNUSED (m); |
1056 NS_LOG_FUNCTION (this); | 1056 NS_LOG_FUNCTION (this); |
1057 return GenericWirelessTxTrace (context, p, AnimationInterface::WIMAX); | 1057 return GenericWirelessTxTrace (context, p, AnimationInterface::WIMAX); |
1058 } | 1058 } |
1059 | 1059 |
1060 | 1060 |
1061 void· | 1061 void· |
1062 AnimationInterface::WimaxRxTrace (std::string context, Ptr<const Packet> p, cons
t Mac48Address & m) | 1062 AnimationInterface::WimaxRxTrace (std::string context, Ptr<const Packet> p, cons
t Mac48Address & m) |
1063 { | 1063 { |
1064 NS_UNUSED(m); | 1064 NS_UNUSED (m); |
1065 NS_LOG_FUNCTION (this); | 1065 NS_LOG_FUNCTION (this); |
1066 return GenericWirelessRxTrace (context, p, AnimationInterface::WIMAX); | 1066 return GenericWirelessRxTrace (context, p, AnimationInterface::WIMAX); |
1067 } | 1067 } |
1068 | 1068 |
1069 void· | 1069 void· |
1070 AnimationInterface::LteTxTrace (std::string context, Ptr<const Packet> p, const
Mac48Address & m) | 1070 AnimationInterface::LteTxTrace (std::string context, Ptr<const Packet> p, const
Mac48Address & m) |
1071 { | 1071 { |
1072 NS_UNUSED(m); | 1072 NS_UNUSED (m); |
1073 NS_LOG_FUNCTION (this); | 1073 NS_LOG_FUNCTION (this); |
1074 return GenericWirelessTxTrace (context, p, AnimationInterface::LTE); | 1074 return GenericWirelessTxTrace (context, p, AnimationInterface::LTE); |
1075 } | 1075 } |
1076 | 1076 |
1077 void· | 1077 void· |
1078 AnimationInterface::LteRxTrace (std::string context, Ptr<const Packet> p, const
Mac48Address & m) | 1078 AnimationInterface::LteRxTrace (std::string context, Ptr<const Packet> p, const
Mac48Address & m) |
1079 { | 1079 { |
1080 NS_UNUSED(m); | 1080 NS_UNUSED (m); |
1081 NS_LOG_FUNCTION (this); | 1081 NS_LOG_FUNCTION (this); |
1082 return GenericWirelessRxTrace (context, p, AnimationInterface::LTE); | 1082 return GenericWirelessRxTrace (context, p, AnimationInterface::LTE); |
1083 } | 1083 } |
1084 | 1084 |
1085 void· | 1085 void· |
1086 AnimationInterface::LteSpectrumPhyTxStart (std::string context, Ptr<const Packet
Burst> pb) | 1086 AnimationInterface::LteSpectrumPhyTxStart (std::string context, Ptr<const Packet
Burst> pb) |
1087 { | 1087 { |
1088 NS_LOG_FUNCTION (this); | 1088 NS_LOG_FUNCTION (this); |
1089 CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS; | 1089 CHECK_STARTED_INTIMEWINDOW_TRACKPACKETS; |
1090 if (!pb)· | 1090 if (!pb)· |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 | 2052 |
2053 void· | 2053 void· |
2054 AnimationInterface::WriteNodeEnergies () | 2054 AnimationInterface::WriteNodeEnergies () |
2055 { | 2055 { |
2056 m_remainingEnergyCounterId = AddNodeCounter ("RemainingEnergy", AnimationInter
face::DOUBLE_COUNTER); | 2056 m_remainingEnergyCounterId = AddNodeCounter ("RemainingEnergy", AnimationInter
face::DOUBLE_COUNTER); |
2057 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) | 2057 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
2058 { | 2058 { |
2059 Ptr<Node> n = *i; | 2059 Ptr<Node> n = *i; |
2060 if (NodeList::GetNode (n->GetId ())->GetObject<EnergySource> ()) | 2060 if (NodeList::GetNode (n->GetId ())->GetObject<EnergySource> ()) |
2061 { | 2061 { |
2062 UpdateNodeCounter (m_remainingEnergyCounterId, n->GetId (), 1.0); | 2062 UpdateNodeCounter (m_remainingEnergyCounterId, n->GetId (), 1); |
2063 } | 2063 } |
2064 } | 2064 } |
2065 } | 2065 } |
2066 | 2066 |
2067 bool· | 2067 bool· |
2068 AnimationInterface::IsInTimeWindow () | 2068 AnimationInterface::IsInTimeWindow () |
2069 { | 2069 { |
2070 if ((Simulator::Now () >= m_startTime) &&· | 2070 if ((Simulator::Now () >= m_startTime) &&· |
2071 (Simulator::Now () <= m_stopTime)) | 2071 (Simulator::Now () <= m_stopTime)) |
2072 return true; | 2072 return true; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); | 2450 element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
2451 element.AddAttribute ("fromId", fromId); | 2451 element.AddAttribute ("fromId", fromId); |
2452 element.AddAttribute ("toId", toId); | 2452 element.AddAttribute ("toId", toId); |
2453 element.AddAttribute ("ld", linkDescription, true); | 2453 element.AddAttribute ("ld", linkDescription, true); |
2454 WriteN (element.ToString (), m_f); | 2454 WriteN (element.ToString (), m_f); |
2455 } | 2455 } |
2456 | 2456 |
2457 void· | 2457 void· |
2458 AnimationInterface::WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId) | 2458 AnimationInterface::WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId) |
2459 { | 2459 { |
2460 NS_UNUSED(toLp); | 2460 NS_UNUSED (toLp); |
2461 AnimXmlElement element ("link"); | 2461 AnimXmlElement element ("link"); |
2462 element.AddAttribute ("fromId", fromId); | 2462 element.AddAttribute ("fromId", fromId); |
2463 element.AddAttribute ("toId", toId); | 2463 element.AddAttribute ("toId", toId); |
2464 | 2464 |
2465 LinkProperties lprop ; | 2465 LinkProperties lprop ; |
2466 lprop.fromNodeDescription = ""; | 2466 lprop.fromNodeDescription = ""; |
2467 lprop.toNodeDescription = ""; | 2467 lprop.toNodeDescription = ""; |
2468 lprop.linkDescription = ""; | 2468 lprop.linkDescription = ""; |
2469 | 2469 |
2470 P2pLinkNodeIdPair p1 = { fromId, toId }; | 2470 P2pLinkNodeIdPair p1 = { fromId, toId }; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2709 } | 2709 } |
2710 | 2710 |
2711 | 2711 |
2712 | 2712 |
2713 /***** AnimXmlElement *****/ | 2713 /***** AnimXmlElement *****/ |
2714 | 2714 |
2715 AnimationInterface::AnimXmlElement::AnimXmlElement(std::string tagName, bool emp
tyElement) : | 2715 AnimationInterface::AnimXmlElement::AnimXmlElement(std::string tagName, bool emp
tyElement) : |
2716 m_tagName(tagName), | 2716 m_tagName(tagName), |
2717 m_text("") | 2717 m_text("") |
2718 { | 2718 { |
2719 NS_UNUSED(emptyElement); | 2719 NS_UNUSED (emptyElement); |
2720 } | 2720 } |
2721 | 2721 |
2722 template <typename T> | 2722 template <typename T> |
2723 void | 2723 void |
2724 AnimationInterface::AnimXmlElement::AddAttribute(std::string attribute, T value,
bool xmlEscape) | 2724 AnimationInterface::AnimXmlElement::AddAttribute(std::string attribute, T value,
bool xmlEscape) |
2725 { | 2725 { |
2726 std::ostringstream oss; | 2726 std::ostringstream oss; |
2727 oss << std::setprecision(10); | 2727 oss << std::setprecision(10); |
2728 oss << value; | 2728 oss << value; |
2729 std::string attributeString = attribute.c_str(); | 2729 std::string attributeString = attribute.c_str(); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2915 | 2915 |
2916 void· | 2916 void· |
2917 AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr<const NetDevice> nd, con
st double fbRx) | 2917 AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr<const NetDevice> nd, con
st double fbRx) |
2918 { | 2918 { |
2919 Ptr <Node> n = nd->GetNode (); | 2919 Ptr <Node> n = nd->GetNode (); |
2920 m_fbRx = fbRx; | 2920 m_fbRx = fbRx; |
2921 m_rxnd = nd; | 2921 m_rxnd = nd; |
2922 } | 2922 } |
2923 | 2923 |
2924 } // namespace ns3 | 2924 } // namespace ns3 |
LEFT | RIGHT |