Skip to content

Commit 6bbbf9e

Browse files
author
srenevic
committed
data
1 parent 503a59d commit 6bbbf9e

File tree

9 files changed

+15
-2
lines changed

9 files changed

+15
-2
lines changed

scratch/sample1.cc

+15-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ std::map<uint16_t,Time> data;
6969
std::map<Ptr<NetDevice>,DataRate> rate;
7070
std::string folder;
7171
uint32_t packetSize;
72+
double refresh;
7273

7374
uint32_t active_flows;
74-
Ptr<OutputStreamWrapper> flowstream,utilstream;
75+
Ptr<OutputStreamWrapper> flowstream,utilstream,datastream;
7576

7677
static void
7778
BufferChange (Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
@@ -99,6 +100,13 @@ BwChange (DataRate dr, double oldCwnd, double newCwnd)
99100

100101
}
101102

103+
static void
104+
DataChange (Ptr<PointToPointNetDevice> netDev)
105+
{
106+
*datastream->GetStream() << Simulator::Now().GetSeconds() << "\t" << netDev<<"\t"<<netDev->GetData()<< std::endl;
107+
Simulator::Schedule (Seconds (refresh), &DataChange, netDev);
108+
}
109+
102110
/*
103111
void LogCache(Ptr<InrppL3Protocol> inrpp)
104112
{
@@ -121,6 +129,7 @@ main (int argc, char *argv[])
121129
{
122130

123131
packetSize = 1500;
132+
refresh = 1.0;
124133
//t = Simulator::Now();
125134
std::string topo_file_name = "3257.pop.cch";
126135
std::string protocol = "i";
@@ -277,6 +286,10 @@ main (int argc, char *argv[])
277286
osstr13 << folder << "/util.tr";
278287
utilstream = asciiTraceHelper.CreateFileStream (osstr13.str());
279288

289+
std::ostringstream osstr14;
290+
osstr14 << folder << "/data.tr";
291+
datastream = asciiTraceHelper.CreateFileStream (osstr14.str());
292+
280293
NS_LOG_INFO ("Create channels.");
281294
//pointToPoint.SetDeviceAttribute ("DataRate", StringValue (bottleneck));
282295
//pointToPoint.SetChannelAttribute ("Delay", StringValue ("1ms"));
@@ -326,7 +339,7 @@ main (int argc, char *argv[])
326339
*utilstream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << devices.Get(0)<<"\t"<<bitrate.GetBitRate()<<"\t"<<0 << std::endl;
327340
*utilstream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << devices.Get(1)<<"\t"<<bitrate.GetBitRate()<<"\t"<<0 << std::endl;
328341

329-
342+
Simulator::Schedule (Seconds (1.0), &DataChange, devices.Get(0)->GetObject<PointToPointNetDevice>());
330343
//std::ostringstream devosstr;
331344
//devosstr << folder << "/p2pdevice_0.tr";
332345
//Ptr<OutputStreamWrapper> streamtrdev = asciiTraceHelper.CreateFileStream (devosstr.str());

utils.pyc

64 Bytes
Binary file not shown.

waf-tools/boost.pyc

0 Bytes
Binary file not shown.

waf-tools/cflags.pyc

352 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

160 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)