@@ -69,9 +69,10 @@ std::map<uint16_t,Time> data;
69
69
std::map<Ptr <NetDevice>,DataRate> rate;
70
70
std::string folder;
71
71
uint32_t packetSize;
72
+ double refresh;
72
73
73
74
uint32_t active_flows;
74
- Ptr <OutputStreamWrapper> flowstream,utilstream;
75
+ Ptr <OutputStreamWrapper> flowstream,utilstream,datastream ;
75
76
76
77
static void
77
78
BufferChange (Ptr <OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
@@ -99,6 +100,13 @@ BwChange (DataRate dr, double oldCwnd, double newCwnd)
99
100
100
101
}
101
102
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
+
102
110
/*
103
111
void LogCache(Ptr<InrppL3Protocol> inrpp)
104
112
{
@@ -121,6 +129,7 @@ main (int argc, char *argv[])
121
129
{
122
130
123
131
packetSize = 1500 ;
132
+ refresh = 1.0 ;
124
133
// t = Simulator::Now();
125
134
std::string topo_file_name = " 3257.pop.cch" ;
126
135
std::string protocol = " i" ;
@@ -277,6 +286,10 @@ main (int argc, char *argv[])
277
286
osstr13 << folder << " /util.tr" ;
278
287
utilstream = asciiTraceHelper.CreateFileStream (osstr13.str ());
279
288
289
+ std::ostringstream osstr14;
290
+ osstr14 << folder << " /data.tr" ;
291
+ datastream = asciiTraceHelper.CreateFileStream (osstr14.str ());
292
+
280
293
NS_LOG_INFO (" Create channels." );
281
294
// pointToPoint.SetDeviceAttribute ("DataRate", StringValue (bottleneck));
282
295
// pointToPoint.SetChannelAttribute ("Delay", StringValue ("1ms"));
@@ -326,7 +339,7 @@ main (int argc, char *argv[])
326
339
*utilstream->GetStream () << Simulator::Now ().GetSeconds () << " \t " << devices.Get (0 )<<" \t " <<bitrate.GetBitRate ()<<" \t " <<0 << std::endl;
327
340
*utilstream->GetStream () << Simulator::Now ().GetSeconds () << " \t " << devices.Get (1 )<<" \t " <<bitrate.GetBitRate ()<<" \t " <<0 << std::endl;
328
341
329
-
342
+ Simulator::Schedule ( Seconds ( 1.0 ), &DataChange, devices. Get ( 0 )-> GetObject <PointToPointNetDevice>());
330
343
// std::ostringstream devosstr;
331
344
// devosstr << folder << "/p2pdevice_0.tr";
332
345
// Ptr<OutputStreamWrapper> streamtrdev = asciiTraceHelper.CreateFileStream (devosstr.str());
0 commit comments