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 * Copyright (c) 2016 NITK Surathkal | 3 * Copyright (c) 2016 NITK Surathkal |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 if ((queueDiscType != "RED") && (queueDiscType != "PI")) | 65 if ((queueDiscType != "RED") && (queueDiscType != "PI")) |
66 { | 66 { |
67 std::cout << "Invalid queue disc type: Use --queueDiscType=RED or --queueD
iscType=PI" << std::endl; | 67 std::cout << "Invalid queue disc type: Use --queueDiscType=RED or --queueD
iscType=PI" << std::endl; |
68 exit (1); | 68 exit (1); |
69 } | 69 } |
70 | 70 |
71 Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (pktSiz
e)); | 71 Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (pktSiz
e)); |
72 Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (appDataRat
e)); | 72 Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (appDataRat
e)); |
73 | 73 |
74 Config::SetDefault ("ns3::Queue::Mode", StringValue ("QUEUE_MODE_PACKETS")); | 74 Config::SetDefault ("ns3::QueueBase::Mode", StringValue ("QUEUE_MODE_PACKETS")
); |
75 Config::SetDefault ("ns3::Queue::MaxPackets", UintegerValue (maxPackets)); | 75 Config::SetDefault ("ns3::QueueBase::MaxPackets", UintegerValue (maxPackets)); |
76 | 76 |
77 if (!modeBytes) | 77 if (!modeBytes) |
78 { | 78 { |
79 Config::SetDefault ("ns3::PiQueueDisc::Mode", StringValue ("QUEUE_MODE_PAC
KETS")); | 79 Config::SetDefault ("ns3::PiQueueDisc::Mode", StringValue ("QUEUE_DISC_MOD
E_PACKETS")); |
80 Config::SetDefault ("ns3::PiQueueDisc::QueueLimit", DoubleValue (queueDisc
LimitPackets)); | 80 Config::SetDefault ("ns3::PiQueueDisc::QueueLimit", DoubleValue (queueDisc
LimitPackets)); |
81 Config::SetDefault ("ns3::PiQueueDisc::QueueRef", DoubleValue (queueDiscRe
fPackets)); | 81 Config::SetDefault ("ns3::PiQueueDisc::QueueRef", DoubleValue (queueDiscRe
fPackets)); |
82 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_MODE_PA
CKETS")); | 82 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_DISC_MO
DE_PACKETS")); |
83 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (queueD
iscLimitPackets)); | 83 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (queueD
iscLimitPackets)); |
84 } | 84 } |
85 else | 85 else |
86 { | 86 { |
87 Config::SetDefault ("ns3::PiQueueDisc::Mode", StringValue ("QUEUE_MODE_BYT
ES")); | 87 Config::SetDefault ("ns3::PiQueueDisc::Mode", StringValue ("QUEUE_DISC_MOD
E_BYTES")); |
88 Config::SetDefault ("ns3::PiQueueDisc::QueueLimit", DoubleValue (queueDisc
LimitPackets * pktSize)); | 88 Config::SetDefault ("ns3::PiQueueDisc::QueueLimit", DoubleValue (queueDisc
LimitPackets * pktSize)); |
89 Config::SetDefault ("ns3::PiQueueDisc::QueueRef", DoubleValue (queueDiscRe
fPackets * pktSize)); | 89 Config::SetDefault ("ns3::PiQueueDisc::QueueRef", DoubleValue (queueDiscRe
fPackets * pktSize)); |
90 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_MODE_BY
TES")); | 90 Config::SetDefault ("ns3::RedQueueDisc::Mode", StringValue ("QUEUE_DISC_MO
DE_BYTES")); |
91 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (queueD
iscLimitPackets * pktSize)); | 91 Config::SetDefault ("ns3::RedQueueDisc::QueueLimit", UintegerValue (queueD
iscLimitPackets * pktSize)); |
92 minTh *= pktSize; | 92 minTh *= pktSize; |
93 maxTh *= pktSize; | 93 maxTh *= pktSize; |
94 } | 94 } |
95 | 95 |
96 if (queueDiscType == "RED") | 96 if (queueDiscType == "RED") |
97 { | 97 { |
98 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (minTh)); | 98 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (minTh)); |
99 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (maxTh)); | 99 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (maxTh)); |
100 Config::SetDefault ("ns3::RedQueueDisc::LinkBandwidth", StringValue (bottl
eNeckLinkBw)); | 100 Config::SetDefault ("ns3::RedQueueDisc::LinkBandwidth", StringValue (bottl
eNeckLinkBw)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); | 178 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
179 | 179 |
180 std::cout << "Running the simulation" << std::endl; | 180 std::cout << "Running the simulation" << std::endl; |
181 Simulator::Stop (Seconds (30.0)); | 181 Simulator::Stop (Seconds (30.0)); |
182 Simulator::Run (); | 182 Simulator::Run (); |
183 | 183 |
184 std::cout << "*** Stats from the bottleneck queue disc ***" << std::endl; | 184 std::cout << "*** Stats from the bottleneck queue disc ***" << std::endl; |
185 | 185 |
186 if (queueDiscType == "RED") | 186 if (queueDiscType == "RED") |
187 { | 187 { |
188 RedQueueDisc::Stats st = StaticCast<RedQueueDisc> (queueDiscs.Get (0))->Ge
tStats (); | 188 QueueDisc::Stats st = queueDiscs.Get (0)->GetStats (); |
189 if (st.unforcedDrop == 0) | 189 if (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP) == 0) |
190 { | 190 { |
191 std::cout << "There should be some unforced drops" << std::endl; | 191 std::cout << "There should be some unforced drops" << std::endl; |
192 exit (1); | 192 exit (1); |
193 } | 193 } |
194 | 194 |
195 if (st.qLimDrop != 0) | 195 if (st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP) != 0) |
196 { | 196 { |
197 std::cout << "There should be zero drops due to queue full" << std::en
dl; | 197 std::cout << "There should be zero drops due to queue full" << std::en
dl; |
198 exit (1); | 198 exit (1); |
199 } | 199 } |
200 std::cout << "\t " << st.unforcedDrop << " drops due to prob mark" << std:
:endl; | 200 std::cout << st << std::endl; |
201 std::cout << "\t " << st.forcedDrop << " drops due to hard mark" << std::e
ndl; | 201 } |
202 std::cout << "\t " << st.qLimDrop << " drops due to queue full" << std::en
dl; | 202 else |
203 } | 203 { |
204 else | 204 QueueDisc::Stats st = queueDiscs.Get (0)->GetStats (); |
205 { | 205 if (st.GetNDroppedPackets (PiQueueDisc::UNFORCED_DROP) == 0 || st.GetNDrop
pedPackets (PiQueueDisc::FORCED_DROP) == 0) |
206 PiQueueDisc::Stats st = StaticCast<PiQueueDisc> (queueDiscs.Get (0))->GetS
tats (); | |
207 if (st.unforcedDrop == 0 || st.forcedDrop == 0) | |
208 { | 206 { |
209 std::cout << "There should be some unforced and forced drops" << std::
endl; | 207 std::cout << "There should be some unforced and forced drops" << std::
endl; |
210 exit (1); | 208 exit (1); |
211 } | 209 } |
212 std::cout << "\t " << st.unforcedDrop << " drops due to prob mark" << std:
:endl; | 210 std::cout << st << std::endl; |
213 std::cout << "\t " << st.forcedDrop << " drops due to queue limit" << std:
:endl; | |
214 } | 211 } |
215 | 212 |
216 std::cout << "Destroying the simulation" << std::endl; | 213 std::cout << "Destroying the simulation" << std::endl; |
217 Simulator::Destroy (); | 214 Simulator::Destroy (); |
218 return 0; | 215 return 0; |
219 } | 216 } |
LEFT | RIGHT |