Skip to content

Commit f6f098c

Browse files
author
srene
committed
minor modifications
1 parent f7e04e9 commit f6f098c

14 files changed

+44
-55
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
/Debug/
2+
utils.pyc
3+
waf-tools/boost.pyc
4+
waf-tools/cflags.pyc
5+
waf-tools/command.pyc
6+
waf-tools/misc.pyc
7+
waf-tools/relocation.pyc
8+
waf-tools/shellcmd.pyc
9+
wutils.pyc
10+
11+

.project

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<buildSpec>
88
<buildCommand>
99
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
1011
<arguments>
1112
<dictionary>
1213
<key>?name?</key>

scratch/dumbbell.cc

+19-44
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ std::map<Ptr<PacketSink> ,uint32_t> flows;
5959
uint32_t n;
6060
std::vector<Ptr<PacketSink> > sink;*/
6161
std::map<uint16_t,Time> data;
62-
62+
uint32_t packetSize;
6363
std::string folder;
64-
6564
uint32_t active_flows;
6665
Ptr<OutputStreamWrapper> flowstream;
6766

@@ -72,12 +71,12 @@ BufferChange (Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwn
7271

7372
}
7473

75-
static void
74+
/*static void
7675
BwChange (Ptr<OutputStreamWrapper> stream, double oldCwnd, double newCwnd)
7776
{
7877
*stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << newCwnd << std::endl;
7978
80-
}
79+
}*/
8180

8281

8382
void LogCache(Ptr<InrppL3Protocol> inrpp)
@@ -92,37 +91,27 @@ void LogCache(Ptr<InrppL3Protocol> inrpp)
9291
void Sink(Ptr<PacketSink> psink, Ptr<const Packet> p,const Address &ad);
9392

9493
void StartLog(Ptr<Socket> socket,Ptr<NetDevice> netDev, uint16_t port);
95-
void StopFlow(Ptr<PacketSink> p, uint16_t port);
94+
void StopFlow(Ptr<PacketSink> p, uint16_t port,uint32_t size);
9695
void LogState(Ptr<InrppInterface> iface,uint32_t state);
9796

9897
int
9998
main (int argc, char *argv[])
10099
{
101-
//t = Simulator::Now();
100+
packetSize = 1500;
102101
std::string protocol = "i";
103-
//i=0;
104-
//tracing = true;
105-
//tracing2 = true;
106-
//uint32_t maxBytes = 10000000;
107-
bool pcap_tracing=true;
108-
uint32_t stop = 300;
109-
uint32_t n = 1000;
110-
//double time = 0.01;
111-
std::string bottleneck="1Gbps";
112-
uint32_t bneck = 1000000000;
113-
uint32_t mean_n_pkts = (0.015*bneck)/(8*1500);
114-
102+
bool pcap_tracing=false;
103+
uint32_t stop = 300;
104+
uint32_t n = 1000;
105+
std::string bottleneck="1Gbps";
106+
uint32_t bneck = 1000000000;
107+
uint32_t mean_n_pkts = (0.015*bneck)/(8*packetSize);
115108
uint32_t maxPackets = (bneck * 0.05)/(8);
116-
117109
uint32_t maxTh = maxPackets;
118110
uint32_t minTh = maxPackets/2;
119-
120111
uint32_t hCacheTh = bneck * 10/8;
121112
uint32_t lCacheTh = hCacheTh/2;
122113
uint32_t maxCacheSize = hCacheTh*2;
123114
double load = 0.8;
124-
125-
126115
//
127116
// Allow the user to override any of the defaults at
128117
// run-time, via command-line arguments
@@ -221,8 +210,6 @@ main (int argc, char *argv[])
221210
pointToPoint.SetChannelAttribute ("Delay", StringValue ("5ms"));
222211
NetDeviceContainer devices = pointToPoint.Install (nodes.Get(0),nodes.Get(1));
223212

224-
225-
226213
//
227214
// We've got the "hardware" in place. Now we need to add IP addresses.
228215
//
@@ -238,19 +225,18 @@ main (int argc, char *argv[])
238225

239226
DataRate dr(bottleneck);
240227

241-
double lambda = ((dr.GetBitRate() * load) / ((mean_n_pkts) * 1500 * 8.0));
242-
228+
double lambda = ((dr.GetBitRate() * load) / (mean_n_pkts * packetSize * 8.0));
243229

230+
NS_LOG_LOGIC("LAmbda " << packetSize << " " << lambda);
244231
Ptr<ExponentialRandomVariable> m_rv_flow_intval = CreateObject<ExponentialRandomVariable> ();
245232
m_rv_flow_intval->SetAttribute("Mean", DoubleValue(1.0/lambda));
246233
m_rv_flow_intval->SetAttribute("Stream", IntegerValue(2));
247234

248235
Ptr<RandomVariableStream> m_rv_npkts = CreateObject<ParetoRandomVariable> ();
249-
m_rv_npkts->SetAttribute("Mean", DoubleValue(mean_n_pkts*1500));
236+
m_rv_npkts->SetAttribute("Mean", DoubleValue(mean_n_pkts*packetSize));
250237
m_rv_npkts->SetAttribute("Shape", DoubleValue(1.2));
251238
m_rv_npkts->SetAttribute("Stream", IntegerValue(-1));
252239

253-
254240
double time = 1.0;
255241

256242
for(uint32_t i=0;i<n;i++)
@@ -295,7 +281,6 @@ main (int argc, char *argv[])
295281
inrpp.Install (nodes.Get(2+n+i));
296282
}
297283

298-
299284
senders.Add(nodes.Get(2+i));
300285

301286
receivers.Add(nodes.Get(2+n+i));
@@ -318,8 +303,6 @@ main (int argc, char *argv[])
318303
NS_LOG_LOGIC("Ip " << iSource.GetAddress(0));
319304
NS_LOG_LOGIC("Ip 2 " << iDest.GetAddress(1));
320305

321-
322-
323306
uint32_t packets = m_rv_npkts->GetInteger();
324307

325308
BulkSendHelper source ("ns3::TcpSocketFactory",
@@ -345,14 +328,12 @@ main (int argc, char *argv[])
345328
Ptr<PacketSink> psink = DynamicCast<PacketSink> (sinkApps.Get (0));
346329
psink->SetCallback(MakeCallback(&StopFlow));
347330

348-
349-
AsciiTraceHelper asciiTraceHelper;
331+
/* AsciiTraceHelper asciiTraceHelper;
350332
std::ostringstream osstr;
351333
osstr << folder << "/netdeviceRx_"<<i<<".tr";
352334
Ptr<OutputStreamWrapper> streamtr = asciiTraceHelper.CreateFileStream (osstr.str());
353335
DynamicCast<PacketSink> (sinkApps.Get (0))->TraceConnectWithoutContext ("EstimatedBW", MakeBoundCallback (&BwChange, streamtr));
354-
355-
336+
*/
356337
num++;
357338
if(num==256)
358339
{
@@ -362,7 +343,6 @@ main (int argc, char *argv[])
362343

363344
}
364345

365-
366346
if(pcap_tracing)
367347
{
368348
std::ostringstream osstr3;
@@ -377,13 +357,9 @@ main (int argc, char *argv[])
377357
Ptr<InrppL3Protocol> ip = nodes.Get(0)->GetObject<InrppL3Protocol> ();
378358
ip->SetCallback(MakeCallback(&LogState));
379359
Simulator::Schedule(Seconds(1.0),&LogCache,ip);
380-
381-
382360
}else
383361
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
384362

385-
386-
387363
AsciiTraceHelper asciiTraceHelper;
388364
PointerValue ptr;
389365
devices.Get(0)->GetAttribute ("TxQueue", ptr);
@@ -426,18 +402,17 @@ void StartLog(Ptr<Socket> socket,Ptr<NetDevice> netDev, uint16_t port)
426402

427403
}
428404

429-
void StopFlow(Ptr<PacketSink> p, uint16_t port)
405+
void StopFlow(Ptr<PacketSink> p, uint16_t port, uint32_t size)
430406
{
431407
active_flows--;
432-
NS_LOG_LOGIC("Flow ended " << port << " " << active_flows);
408+
NS_LOG_LOGIC("Flow ended " << port << " " << active_flows << " " << size/packetSize);
433409

434410
std::map<uint16_t,Time>::iterator it = data.find(port);
435411
if(it!=data.end())
436-
*flowstream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << port << "\t" << Simulator::Now ().GetSeconds ()-it->second.GetSeconds() << "\t" << active_flows << std::endl;
412+
*flowstream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << port << "\t" << Simulator::Now ().GetSeconds ()-it->second.GetSeconds() << "\t" << size/packetSize << "\t" << active_flows << std::endl;
437413

438414
}
439415

440-
441416
void LogState(Ptr<InrppInterface> iface,uint32_t state){
442417

443418
NS_LOG_LOGIC("Inrpp state changed " << iface << " to state " << state);

scratch/inrpp_rocketfuel.cc

+10-7
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ uint32_t n;
6767
std::vector<Ptr<PacketSink> > sink;*/
6868
std::map<uint16_t,Time> data;
6969
std::string folder;
70+
uint32_t packetSize;
7071

7172
uint32_t active_flows;
7273
Ptr<OutputStreamWrapper> flowstream;
@@ -100,12 +101,14 @@ void LogCache(Ptr<InrppL3Protocol> inrpp)
100101
void Sink(Ptr<PacketSink> psink, Ptr<const Packet> p,const Address &ad);
101102

102103
void StartLog(Ptr<Socket> socket,Ptr<NetDevice> netDev, uint16_t port);
103-
void StopFlow(Ptr<PacketSink> p, uint16_t port);
104+
void StopFlow(Ptr<PacketSink> p, uint16_t port,uint32_t size);
104105
void LogState(Ptr<InrppInterface> iface,uint32_t state);
105106

106107
int
107108
main (int argc, char *argv[])
108109
{
110+
111+
packetSize = 1500;
109112
//t = Simulator::Now();
110113
std::string protocol = "i";
111114
std::string topo_file_name = "3356.pop.cch";
@@ -115,14 +118,14 @@ main (int argc, char *argv[])
115118
//uint32_t maxBytes = 10000000;
116119
//bool pcap_tracing=false;
117120
uint32_t stop = 300;
118-
uint32_t n = 1000;
121+
uint32_t n = 20;
119122
//double time = 0.01;
120123
std::string bottleneck="1Gbps";
121124
std::string b2g_bottleneck = "20Gbps";
122125
std::string c2g_bottleneck = "20Gbps";
123126

124127
uint32_t bneck = 1000000000;
125-
uint32_t mean_n_pkts = (0.015*bneck)/(8*1500);
128+
uint32_t mean_n_pkts = (0.015*bneck)/(8*packetSize);
126129

127130
uint32_t maxPackets = (bneck * 0.05)/(8);
128131

@@ -155,7 +158,7 @@ main (int argc, char *argv[])
155158
cmd.Parse (argc, argv);
156159

157160
std::ostringstream st;
158-
st << protocol << "test_fl" <<n;
161+
st << protocol << "rockettest_fl" <<n;
159162
folder = st.str();
160163

161164
if (mean_n_pkts < 30)
@@ -478,14 +481,14 @@ void StartLog(Ptr<Socket> socket,Ptr<NetDevice> netDev, uint16_t port)
478481

479482
}
480483

481-
void StopFlow(Ptr<PacketSink> p, uint16_t port)
484+
void StopFlow(Ptr<PacketSink> p, uint16_t port, uint32_t size)
482485
{
483486
active_flows--;
484-
NS_LOG_LOGIC("Flow ended " << port << " " << active_flows);
487+
NS_LOG_LOGIC("Flow ended " << port << " " << active_flows << " " << size/packetSize);
485488

486489
std::map<uint16_t,Time>::iterator it = data.find(port);
487490
if(it!=data.end())
488-
*flowstream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << port << "\t" << Simulator::Now ().GetSeconds ()-it->second.GetSeconds() << "\t" << active_flows << std::endl;
491+
*flowstream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << port << "\t" << Simulator::Now ().GetSeconds ()-it->second.GetSeconds() << "\t" << size/packetSize << "\t" << active_flows << std::endl;
489492

490493
}
491494

src/applications/model/packet-sink.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ void PacketSink::HandleRead (Ptr<Socket> socket)
213213
void PacketSink::HandlePeerClose (Ptr<Socket> socket)
214214
{
215215
NS_LOG_FUNCTION (this << socket);
216-
if(!m_cb.IsNull())m_cb(this,InetSocketAddress::ConvertFrom(m_local).GetPort());
216+
if(!m_cb.IsNull())m_cb(this,InetSocketAddress::ConvertFrom(m_local).GetPort(),m_totalRx);
217217
t = Simulator::Now()-t;
218218

219219
}
220220

221-
void PacketSink::SetCallback(Callback<void, Ptr<PacketSink>, uint16_t> cb)
221+
void PacketSink::SetCallback(Callback<void, Ptr<PacketSink>, uint16_t,uint32_t> cb)
222222
{
223223
m_cb = cb;
224224
}

src/applications/model/packet-sink.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class PacketSink : public Application
9595

9696
Time GetCompletionTime();
9797

98-
void SetCallback(Callback<void,Ptr<PacketSink>, uint16_t> cb);
98+
void SetCallback(Callback<void,Ptr<PacketSink>, uint16_t,uint32_t> cb);
9999

100100
protected:
101101
virtual void DoDispose (void);
@@ -148,7 +148,7 @@ class PacketSink : public Application
148148
uint32_t data;
149149

150150

151-
Callback<void,Ptr<PacketSink>, uint16_t> m_cb;
151+
Callback<void,Ptr<PacketSink>, uint16_t, uint32_t> m_cb;
152152

153153
};
154154

utils.pyc

-12 Bytes
Binary file not shown.

waf-tools/boost.pyc

0 Bytes
Binary file not shown.

waf-tools/cflags.pyc

-66 Bytes
Binary file not shown.

waf-tools/command.pyc

0 Bytes
Binary file not shown.

waf-tools/misc.pyc

0 Bytes
Binary file not shown.

waf-tools/relocation.pyc

0 Bytes
Binary file not shown.

waf-tools/shellcmd.pyc

0 Bytes
Binary file not shown.

wutils.pyc

-30 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)