OLD | NEW |
1 .. include:: replace.txt | 1 .. include:: replace.txt |
2 .. highlight:: cpp | 2 .. highlight:: cpp |
3 | 3 |
4 .. heading hierarchy: | 4 .. heading hierarchy: |
5 ************* Section (#.#) | 5 ************* Section (#.#) |
6 ============= Subsection (#.#.#) | 6 ============= Subsection (#.#.#) |
7 ############# Paragraph (no number) | 7 ############# Paragraph (no number) |
8 ~~~~~~~~~~~~~ Sub-paragraph (no number) | 8 ~~~~~~~~~~~~~ Sub-paragraph (no number) |
9 | 9 |
10 Data Collection Helpers | 10 Data Collection Helpers |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ###################### | 57 ###################### |
58 | 58 |
59 The GnuplotHelper will create 3 different files at the end of the | 59 The GnuplotHelper will create 3 different files at the end of the |
60 simulation: | 60 simulation: |
61 | 61 |
62 - A space separated gnuplot data file | 62 - A space separated gnuplot data file |
63 - A gnuplot control file | 63 - A gnuplot control file |
64 - A shell script to generate the gnuplot | 64 - A shell script to generate the gnuplot |
65 | 65 |
66 There are two configuration statements that are needed to produce plots. | 66 There are two configuration statements that are needed to produce plots. |
67 The first statement configures the plot (filename, title, legends, and | 67 The first statement configures the plot (filename, title, and legends): |
68 output type, where the output type defaults to PNG if unspecified): | |
69 | 68 |
70 :: | 69 :: |
71 | 70 |
72 void ConfigurePlot (const std::string &outputFileNameWithoutExtension, | 71 void ConfigurePlot (const std::string &outputFileNameWithoutExtension, |
73 const std::string &title, | 72 const std::string &title, |
74 const std::string &xLegend, | 73 const std::string &xLegend, |
75 const std::string &yLegend, | 74 const std::string &yLegend); |
76 const std::string &terminalType = ".png"); | 75 |
| 76 This may be further customized by the following optional methods: |
| 77 |
| 78 :: |
| 79 |
| 80 void SetTerminalType (const std::string &terminalType); |
| 81 void SetScalingFactor (double scalingFactor); |
| 82 |
| 83 The first method will change the from the default "png" output file extension. |
| 84 The second method will scale all data output from the collector; e.g. |
| 85 selecting a value of 0.001 will make the y-axis units on the plot in |
| 86 terms of thousands. The default scaling factor is 1. Note that this |
| 87 function must be called before adding probes to have effect on the |
| 88 next data series to be added; it will not cause a scaling factor to |
| 89 be applied to previously added probes. |
77 | 90 |
78 The second statement hooks the trace source of interest: | 91 The second statement hooks the trace source of interest: |
79 | 92 |
80 :: | 93 :: |
81 | 94 |
82 void PlotProbe (const std::string &typeId, | 95 void AddProbe (const std::string &typeId, |
83 const std::string &path, | 96 const std::string &path, |
84 const std::string &probeTraceSource, | 97 const std::string &probeTraceSource, |
85 const std::string &title); | 98 const std::string &title); |
86 | 99 |
87 The arguments are as follows: | 100 The arguments are as follows: |
88 | 101 |
89 * typeId: The |ns3| TypeId of the Probe | 102 * typeId: The |ns3| TypeId of the Probe |
90 * path: The path in the |ns3| configuration namespace to one or more trace sour
ces· | 103 * path: The path in the |ns3| configuration namespace to one or more trace sour
ces· |
91 * probeTraceSource: Which output of the probe (itself a trace source) should be
plotted | 104 * probeTraceSource: Which output of the probe (itself a trace source) should be
plotted |
92 * title: The title to associate with the dataset(s) (in the gnuplot legend) | 105 * title: The title to associate with the dataset(s) (in the gnuplot legend) |
93 | 106 |
94 A variant on the PlotProbe above is to specify a fifth optional argument | 107 A variant on the AddProbe above is to specify a fifth optional argument |
95 that controls where in the plot the key (legend) is placed. | 108 that controls where in the plot the key (legend) is placed. |
96 | 109 |
97 A fully worked example (from ``seventh.cc``) is shown below: | 110 A fully worked example (from ``seventh.cc``) is shown below: |
98 | 111 |
99 :: | 112 :: |
100 | 113 |
101 // Create the gnuplot helper. | 114 // Create the gnuplot helper. |
102 GnuplotHelper plotHelper; | 115 GnuplotHelper plotHelper; |
103 · | 116 · |
104 // Configure the plot. | 117 // Configure the plot. |
105 // Configure the plot. The first argument is the file name prefix | 118 // Configure the plot. The first argument is the file name prefix |
106 // for the output files generated. The second, third, and fourth | 119 // for the output files generated. The second, third, and fourth |
107 // arguments are, respectively, the plot title, x-axis, and y-axis labels | 120 // arguments are, respectively, the plot title, x-axis, and y-axis labels |
108 plotHelper.ConfigurePlot ("seventh-packet-byte-count", | 121 plotHelper.ConfigurePlot ("seventh-packet-byte-count", |
109 "Packet Byte Count vs. Time", | 122 "Packet Byte Count vs. Time", |
110 "Time (Seconds)", | 123 "Time (Seconds)", |
111 "Packet Byte Count", | 124 "Packet Byte Count"); |
112 "png"); | |
113 | 125 |
114 // Specify the probe type, trace source path (in configuration namespace), an
d | 126 // Specify the probe type, trace source path (in configuration namespace), an
d |
115 // probe output trace source ("OutputBytes") to plot. The fourth argument | 127 // probe output trace source ("OutputBytes") to plot. The fourth argument |
116 // specifies the name of the data series label on the plot. The last | 128 // specifies the name of the data series label on the plot. |
117 // argument formats the plot by specifying where the key should be placed. | 129 plotHelper.AddProbe (probeType, |
118 plotHelper.PlotProbe (probeType, | 130 tracePath, |
119 tracePath, | 131 "OutputBytes", |
120 "OutputBytes", | 132 "Packet Byte Count"); |
121 "Packet Byte Count", | |
122 GnuplotAggregator::KEY_BELOW); | |
123 | 133 |
124 In this example, the ``probeType`` and ``tracePath`` are as follows (for IPv4): | 134 In this example, the ``probeType`` and ``tracePath`` are as follows (for IPv4): |
125 | 135 |
126 :: | 136 :: |
127 | 137 |
128 probeType = "ns3::Ipv4PacketProbe"; | 138 probeType = "ns3::Ipv4PacketProbe"; |
129 tracePath = "/NodeList/*/$ns3::Ipv4L3Protocol/Tx"; | 139 tracePath = "/NodeList/*/$ns3::Ipv4L3Protocol/Tx"; |
130 | 140 |
131 The probeType is a key parameter for this helper to work. This TypeId | 141 The probeType is a key parameter for this helper to work. This TypeId |
132 must be registered in the system, and the signature on the Probe's trace | 142 must be registered in the system, and the signature on the Probe's trace |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 The GnuplotHelper's ``ConfigurePlot()`` function can be used· | 182 The GnuplotHelper's ``ConfigurePlot()`` function can be used· |
173 to configure plots. | 183 to configure plots. |
174 | 184 |
175 It has the following prototype: | 185 It has the following prototype: |
176 | 186 |
177 :: | 187 :: |
178 | 188 |
179 void ConfigurePlot (const std::string &outputFileNameWithoutExtension, | 189 void ConfigurePlot (const std::string &outputFileNameWithoutExtension, |
180 const std::string &title, | 190 const std::string &title, |
181 const std::string &xLegend, | 191 const std::string &xLegend, |
182 const std::string &yLegend, | 192 const std::string &yLegend); |
183 const std::string &terminalType = ".png"); | |
184 | 193 |
185 It has the following arguments: | 194 It has the following arguments: |
186 | 195 |
187 +--------------------------------+------------------------------+ | 196 +--------------------------------+------------------------------+ |
188 | Argument | Description | | 197 | Argument | Description | |
189 +================================+==============================+ | 198 +================================+==============================+ |
190 | outputFileNameWithoutExtension | Name of gnuplot related files| | 199 | outputFileNameWithoutExtension | Name of gnuplot related files| |
191 | | to write with no extension. | | 200 | | to write with no extension. | |
192 +--------------------------------+------------------------------+ | 201 +--------------------------------+------------------------------+ |
193 | title | Plot title string to use for | | 202 | title | Plot title string to use for | |
194 | | this plot. | | 203 | | this plot. | |
195 +--------------------------------+------------------------------+ | 204 +--------------------------------+------------------------------+ |
196 | xLegend | The legend for the x | | 205 | xLegend | The legend for the x | |
197 | | horizontal axis. | | 206 | | horizontal axis. | |
198 +--------------------------------+------------------------------+ | 207 +--------------------------------+------------------------------+ |
199 | yLegend | The legend for the y | | 208 | yLegend | The legend for the y | |
200 | | vertical axis. | | 209 | | vertical axis. | |
201 +--------------------------------+------------------------------+ | 210 +--------------------------------+------------------------------+ |
202 | terminalType | Terminal type setting string | | |
203 | | for output. The default | | |
204 | | terminal type is "png". | | |
205 +--------------------------------+------------------------------+ | |
206 ·· | 211 ·· |
207 The GnuplotHelper's ``ConfigurePlot()`` function configures plot· | 212 The GnuplotHelper's ``ConfigurePlot()`` function configures plot· |
208 related parameters for this gnuplot helper so | 213 related parameters for this gnuplot helper so |
209 that it will create a space separated gnuplot data file named | 214 that it will create a space separated gnuplot data file named |
210 outputFileNameWithoutExtension + ".dat", a gnuplot control file | 215 outputFileNameWithoutExtension + ".dat", a gnuplot control file |
211 named outputFileNameWithoutExtension + ".plt", and a shell script | 216 named outputFileNameWithoutExtension + ".plt", and a shell script |
212 to generate the gnuplot named outputFileNameWithoutExtension + | 217 to generate the gnuplot named outputFileNameWithoutExtension + |
213 ".sh". | 218 ".sh". |
214 | 219 |
215 An example of how to use this function can be seen in the· | 220 An example of how to use this function can be seen in the· |
216 ``seventh.cc`` code described above where it was used as follows: | 221 ``seventh.cc`` code described above where it was used as follows: |
217 | 222 |
218 :: | 223 :: |
219 | 224 |
220 plotHelper.ConfigurePlot ("seventh-packet-byte-count", | 225 plotHelper.ConfigurePlot ("seventh-packet-byte-count", |
221 "Packet Byte Count vs. Time", | 226 "Packet Byte Count vs. Time", |
222 "Time (Seconds)", | 227 "Time (Seconds)", |
223 "Packet Byte Count", | 228 "Packet Byte Count"); |
224 "png"); | |
225 | 229 |
226 GnuplotHelper PlotProbe | 230 GnuplotHelper AddProbe |
227 ####################### | 231 ###################### |
228 | 232 |
229 The GnuplotHelper's ``PlotProbe()`` function can be used· | 233 The GnuplotHelper's ``AddProbe()`` function can be used· |
230 to plot values generated by probes. | 234 to plot values generated by probes. |
231 | 235 |
232 It has the following prototype: | 236 It has the following prototype: |
233 | 237 |
234 :: | 238 :: |
235 | 239 |
236 void PlotProbe (const std::string &typeId, | 240 void AddProbe (const std::string &typeId, |
237 const std::string &path, | 241 const std::string &path, |
238 const std::string &probeTraceSource, | 242 const std::string &probeTraceSource, |
239 const std::string &title, | 243 const std::string &title); |
240 enum GnuplotAggregator::KeyLocation keyLocation = GnuplotAggre
gator::KEY_INSIDE); | |
241 | 244 |
242 It has the following arguments: | 245 It has the following arguments: |
243 | 246 |
244 +------------------+------------------------------+ | 247 +------------------+------------------------------+ |
245 | Argument | Description | | 248 | Argument | Description | |
246 +==================+==============================+ | 249 +==================+==============================+ |
247 | typeId | The type ID for the probe | | 250 | typeId | The type ID for the probe | |
248 | | created by this helper. | | 251 | | created by this helper. | |
249 +------------------+------------------------------+ | 252 +------------------+------------------------------+ |
250 | path | Config path to access the | | 253 | path | Config path to access the | |
251 | | trace source. | | 254 | | trace source. | |
252 +------------------+------------------------------+ | 255 +------------------+------------------------------+ |
253 | probeTraceSource | The probe trace source to | | 256 | probeTraceSource | The probe trace source to | |
254 | | access. | | 257 | | access. | |
255 +------------------+------------------------------+ | 258 +------------------+------------------------------+ |
256 | title | The title to be associated | | 259 | title | The title to be associated | |
257 | | to this dataset | | 260 | | to this dataset | |
258 +------------------+------------------------------+ | 261 +------------------+------------------------------+ |
259 | keyLocation | The location of the key in | | |
260 | | the plot. The default | | |
261 | | location is inside. | | |
262 +------------------+------------------------------+ | |
263 ·· | 262 ·· |
264 The GnuplotHelper's ``PlotProbe()`` function· | 263 The GnuplotHelper's ``AddProbe()`` function· |
265 plots a dataset generated by hooking the |ns3| trace source with a | 264 plots a dataset generated by hooking the |ns3| trace source with a |
266 probe created by the helper, and then plotting the values from the· | 265 probe created by the helper, and then plotting the values from the· |
267 probeTraceSource.· | 266 probeTraceSource.· |
268 The dataset will have the provided title, and will consist of· | 267 The dataset will have the provided title, and will consist of· |
269 the 'newValue' at each timestamp. | 268 the 'newValue' at each timestamp. |
270 | 269 |
271 If the config path has more than one match in the system because· | 270 If the config path has more than one match in the system because· |
272 there is a wildcard, then one dataset for each match will | 271 there is a wildcard, then one dataset for each match will |
273 be plotted. The dataset titles will be suffixed with the matched | 272 be plotted. The dataset titles will be suffixed with the matched |
274 characters for each of the wildcards in the config path, | 273 characters for each of the wildcards in the config path, |
275 separated by spaces. For example, if the proposed dataset title | 274 separated by spaces. For example, if the proposed dataset title |
276 is the string "bytes", and there are two wildcards in the path, | 275 is the string "bytes", and there are two wildcards in the path, |
277 then dataset titles like "bytes-0 0" or "bytes-12 9" will be | 276 then dataset titles like "bytes-0 0" or "bytes-12 9" will be |
278 possible as labels for the datasets that are plotted. | 277 possible as labels for the datasets that are plotted. |
279 | 278 |
280 An example of how to use this function can be seen in the· | 279 An example of how to use this function can be seen in the· |
281 ``seventh.cc`` code described above where it was used (with | 280 ``seventh.cc`` code described above where it was used (with |
282 variable substitution) as follows: | 281 variable substitution) as follows: |
283 | 282 |
284 :: | 283 :: |
285 | 284 |
286 plotHelper.PlotProbe ("ns3::Ipv4PacketProbe", | 285 plotHelper.AddProbe ("ns3::Ipv4PacketProbe", |
287 "/NodeList/*/$ns3::Ipv4L3Protocol/Tx", | 286 "/NodeList/*/$ns3::Ipv4L3Protocol/Tx", |
288 "OutputBytes", | 287 "OutputBytes", |
289 "Packet Byte Count", | 288 "Packet Byte Count"); |
290 GnuplotAggregator::KEY_BELOW); | |
291 | 289 |
292 Other Examples | 290 Other Examples |
293 ############## | 291 ############## |
294 | 292 |
295 Gnuplot Helper Example | 293 Gnuplot Helper Example |
296 ~~~~~~~~~~~~~~~~~~~~~~ | 294 ~~~~~~~~~~~~~~~~~~~~~~ |
297 | 295 |
298 A slightly simpler example than the ``seventh.cc`` example can be· | 296 A slightly simpler example than the ``seventh.cc`` example can be· |
299 found in ``src/stats/examples/gnuplot-helper-example.cc``. The· | 297 found in ``src/stats/examples/gnuplot-helper-example.cc``. The· |
300 following 2-D gnuplot was created using the example. | 298 following 2-D gnuplot was created using the example. |
(...skipping 21 matching lines...) Expand all Loading... |
322 | 320 |
323 :: | 321 :: |
324 | 322 |
325 // Create the gnuplot helper. | 323 // Create the gnuplot helper. |
326 GnuplotHelper plotHelper; | 324 GnuplotHelper plotHelper; |
327 | 325 |
328 // Configure the plot. | 326 // Configure the plot. |
329 plotHelper.ConfigurePlot ("gnuplot-helper-example", | 327 plotHelper.ConfigurePlot ("gnuplot-helper-example", |
330 "Emitter Counts vs. Time", | 328 "Emitter Counts vs. Time", |
331 "Time (Seconds)", | 329 "Time (Seconds)", |
332 "Emitter Count", | 330 "Emitter Count"); |
333 "png"); | |
334 | 331 |
335 // Plot the values generated by the probe. The path that we provide | 332 // Plot the values generated by the probe. The path that we provide |
336 // helps to disambiguate the source of the trace. | 333 // helps to disambiguate the source of the trace. |
337 plotHelper.PlotProbe ("ns3::Uinteger32Probe", | 334 plotHelper.AddProbe ("ns3::Uinteger32Probe", |
338 "/Names/Emitter/Counter", | 335 "/Names/Emitter/Counter", |
339 "Output", | 336 "Output", |
340 "Emitter Count", | 337 "Emitter Count"); |
341 GnuplotAggregator::KEY_INSIDE); | 338 |
| 339 plotHelper.SetCollectorType("ns3::EventDrivenCollector"); |
| 340 |
| 341 Note also that there is a ``SetCollectorType`` method. This can |
| 342 be used to specify different collector types than the (default) |
| 343 ``ns3::EventDrivenCollector``. The above statement just sets |
| 344 the collector type to the default (and is therefore unnecessary) but |
| 345 can be used to specify other collector types (such as a TimeSeriesCollector) |
| 346 and configure the collector attributes. |
342 | 347 |
343 FileHelper | 348 FileHelper |
344 ========== | 349 ========== |
345 | 350 |
346 The FileHelper is a helper class used to put data values into a file. | 351 The FileHelper is a helper class used to put data values into a file. |
347 The overall goal is to provide the ability for users | 352 The overall goal is to provide the ability for users |
348 to quickly make formatted text files from data exported in |ns3|· | 353 to quickly make formatted text files from data exported in |ns3|· |
349 trace sources. By default, a minimal amount of data transformation is· | 354 trace sources. By default, a minimal amount of data transformation is· |
350 performed; the objective is to generate files with as few (default)· | 355 performed; the objective is to generate files with as few (default)· |
351 configuration statements as possible. | 356 configuration statements as possible. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 414 |
410 The new code that was added to produce the two text files is below.·· | 415 The new code that was added to produce the two text files is below.·· |
411 More details about this API will be covered in a later section.· | 416 More details about this API will be covered in a later section.· |
412 | 417 |
413 Note that because there were 2 matches for the wildcard in the path,· | 418 Note that because there were 2 matches for the wildcard in the path,· |
414 2 separate text files were created. The first text file, which is· | 419 2 separate text files were created. The first text file, which is· |
415 named "seventh-packet-byte-count-0.txt", corresponds to the· | 420 named "seventh-packet-byte-count-0.txt", corresponds to the· |
416 wildcard match with the "*" replaced with "0". The second text file,· | 421 wildcard match with the "*" replaced with "0". The second text file,· |
417 which is named "seventh-packet-byte-count-1.txt", corresponds to· | 422 which is named "seventh-packet-byte-count-1.txt", corresponds to· |
418 the wildcard match with the "*" replaced with "1". Also, note that· | 423 the wildcard match with the "*" replaced with "1". Also, note that· |
419 the function call to ``WriteProbe()`` will give an error message if· | 424 the function call to ``AddProbe()`` will give an error message if· |
420 there are no matches for a path that contains wildcards. | 425 there are no matches for a path that contains wildcards. |
421 | 426 |
422 :: | 427 :: |
423 | 428 |
424 // Create the file helper. | 429 // Create the file helper. |
425 FileHelper fileHelper; | 430 FileHelper fileHelper; |
426 · | 431 · |
427 // Configure the file to be written. | 432 // Configure the file to be written. |
428 fileHelper.ConfigureFile ("seventh-packet-byte-count", | 433 fileHelper.ConfigureFile ("seventh-packet-byte-count", |
429 FileAggregator::FORMATTED); | 434 FileAggregator::FORMATTED); |
430 | 435 |
431 // Set the labels for this formatted output file. | 436 // Set the labels for this formatted output file. |
432 fileHelper.Set2dFormat ("Time (Seconds) = %.3e\tPacket Byte Count = %.0f"); | 437 fileHelper.Set2dFormat ("Time (Seconds) = %.3e\tPacket Byte Count = %.0f"); |
433 | 438 |
434 // Write the values generated by the probe. | 439 // Write the values generated by the probe. |
435 fileHelper.WriteProbe ("ns3::Ipv4PacketProbe", | 440 fileHelper.AddProbe ("ns3::Ipv4PacketProbe", |
436 "/NodeList/*/$ns3::Ipv4L3Protocol/Tx", | 441 "/NodeList/*/$ns3::Ipv4L3Protocol/Tx", |
437 "OutputBytes"); | 442 "OutputBytes"); |
438 | 443 |
439 FileHelper ConfigureFile | 444 FileHelper ConfigureFile |
440 ######################## | 445 ######################## |
441 | 446 |
442 The FileHelper's ``ConfigureFile()`` function can be used· | 447 The FileHelper's ``ConfigureFile()`` function can be used· |
443 to configure text files. | 448 to configure text files. |
444 | 449 |
445 It has the following prototype: | 450 It has the following prototype: |
446 | 451 |
447 :: | 452 :: |
(...skipping 22 matching lines...) Expand all Loading... |
470 is space-separated. | 475 is space-separated. |
471 | 476 |
472 An example of how to use this function can be seen in the· | 477 An example of how to use this function can be seen in the· |
473 ``seventh.cc`` code described above where it was used as follows: | 478 ``seventh.cc`` code described above where it was used as follows: |
474 | 479 |
475 :: | 480 :: |
476 | 481 |
477 fileHelper.ConfigureFile ("seventh-packet-byte-count", | 482 fileHelper.ConfigureFile ("seventh-packet-byte-count", |
478 FileAggregator::FORMATTED); | 483 FileAggregator::FORMATTED); |
479 | 484 |
480 FileHelper WriteProbe | 485 FileHelper AddProbe |
481 ##################### | 486 ##################### |
482 | 487 |
483 The FileHelper's ``WriteProbe()`` function can be used· | 488 The FileHelper's ``AddProbe()`` function can be used· |
484 to write values generated by probes to text files. | 489 to write values generated by probes to text files. |
485 | 490 |
486 It has the following prototype: | 491 It has the following prototype: |
487 | 492 |
488 :: | 493 :: |
489 | 494 |
490 void WriteProbe (const std::string &typeId, | 495 void AddProbe (const std::string &typeId, |
491 const std::string &path, | 496 const std::string &path, |
492 const std::string &probeTraceSource); | 497 const std::string &probeTraceSource); |
493 | 498 |
494 It has the following arguments: | 499 It has the following arguments: |
495 | 500 |
496 +------------------+------------------------------+ | 501 +------------------+------------------------------+ |
497 | Argument | Description | | 502 | Argument | Description | |
498 +==================+==============================+ | 503 +==================+==============================+ |
499 | typeId | The type ID for the probe | | 504 | typeId | The type ID for the probe | |
500 | | to be created. | | 505 | | to be created. | |
501 +------------------+------------------------------+ | 506 +------------------+------------------------------+ |
502 | path | Config path to access the | | 507 | path | Config path to access the | |
503 | | trace source. | | 508 | | trace source. | |
504 +------------------+------------------------------+ | 509 +------------------+------------------------------+ |
505 | probeTraceSource | The probe trace source to | | 510 | probeTraceSource | The probe trace source to | |
506 | | access. | | 511 | | access. | |
507 +------------------+------------------------------+ | 512 +------------------+------------------------------+ |
508 ·· | 513 ·· |
509 The FileHelper's ``WriteProbe()`` function | 514 The FileHelper's ``AddProbe()`` function |
510 creates output text files generated by hooking the ns-3 trace source | 515 creates output text files generated by hooking the ns-3 trace source |
511 with a probe created by the helper, and then writing the values from the | 516 with a probe created by the helper, and then writing the values from the |
512 probeTraceSource. The output file names will have the text stored | 517 probeTraceSource. The output file names will have the text stored |
513 in the member variable m_outputFileNameWithoutExtension plus ".txt",· | 518 in the member variable m_outputFileNameWithoutExtension plus ".txt",· |
514 and will consist of the 'newValue' at each timestamp. | 519 and will consist of the 'newValue' at each timestamp. |
515 | 520 |
516 If the config path has more than one match in the system because | 521 If the config path has more than one match in the system because |
517 there is a wildcard, then one output file for each match | 522 there is a wildcard, then one output file for each match |
518 will be created. The output file names will contain the text in | 523 will be created. The output file names will contain the text in |
519 m_outputFileNameWithoutExtension plus the matched characters for | 524 m_outputFileNameWithoutExtension plus the matched characters for |
520 each of the wildcards in the config path, separated by dashes, | 525 each of the wildcards in the config path, separated by dashes, |
521 plus ".txt". For example, if the value in | 526 plus ".txt". For example, if the value in |
522 m_outputFileNameWithoutExtension is the string | 527 m_outputFileNameWithoutExtension is the string |
523 "packet-byte-count", and there are two wildcards in the path, | 528 "packet-byte-count", and there are two wildcards in the path, |
524 then output file names like "packet-byte-count-0-0.txt" or | 529 then output file names like "packet-byte-count-0-0.txt" or |
525 "packet-byte-count-12-9.txt" will be possible as names for the | 530 "packet-byte-count-12-9.txt" will be possible as names for the |
526 files that will be created. | 531 files that will be created. |
527 | 532 |
528 An example of how to use this function can be seen in the· | 533 An example of how to use this function can be seen in the· |
529 ``seventh.cc`` code described above where it was used as follows: | 534 ``seventh.cc`` code described above where it was used as follows: |
530 | 535 |
531 :: | 536 :: |
532 | 537 |
533 fileHelper.WriteProbe ("ns3::Ipv4PacketProbe", | 538 fileHelper.AddProbe ("ns3::Ipv4PacketProbe", |
534 "/NodeList/*/$ns3::Ipv4L3Protocol/Tx", | 539 "/NodeList/*/$ns3::Ipv4L3Protocol/Tx", |
535 "OutputBytes"); | 540 "OutputBytes"); |
536 | 541 |
537 Other Examples | 542 Other Examples |
538 ############## | 543 ############## |
539 | 544 |
540 File Helper Example | 545 File Helper Example |
541 ~~~~~~~~~~~~~~~~~~~ | 546 ~~~~~~~~~~~~~~~~~~~ |
542 | 547 |
543 A slightly simpler example than the ``seventh.cc`` example can be· | 548 A slightly simpler example than the ``seventh.cc`` example can be· |
544 found in ``src/stats/examples/file-helper-example.cc``.·· | 549 found in ``src/stats/examples/file-helper-example.cc``.·· |
545 This example only uses the FileHelper. | 550 This example only uses the FileHelper. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 588 |
584 // Configure the file to be written. | 589 // Configure the file to be written. |
585 fileHelper.ConfigureFile ("file-helper-example", | 590 fileHelper.ConfigureFile ("file-helper-example", |
586 FileAggregator::FORMATTED); | 591 FileAggregator::FORMATTED); |
587 | 592 |
588 // Set the labels for this formatted output file. | 593 // Set the labels for this formatted output file. |
589 fileHelper.Set2dFormat ("Time (Seconds) = %.3e\tCount = %.0f"); | 594 fileHelper.Set2dFormat ("Time (Seconds) = %.3e\tCount = %.0f"); |
590 | 595 |
591 // Write the values generated by the probe. The path that we | 596 // Write the values generated by the probe. The path that we |
592 // provide helps to disambiguate the source of the trace. | 597 // provide helps to disambiguate the source of the trace. |
593 fileHelper.WriteProbe ("ns3::Uinteger32Probe", | 598 fileHelper.AddProbe ("ns3::Uinteger32Probe", |
594 "/Names/Emitter/Counter", | 599 "/Names/Emitter/Counter", |
595 "Output"); | 600 "Output"); |
596 | 601 |
597 Scope and Limitations | 602 Scope and Limitations |
598 ===================== | 603 ===================== |
599 | 604 |
600 Currently, only these Probes have been implemented and connected | 605 Currently, only these Probes have been implemented and connected |
601 to the GnuplotHelper and to the FileHelper: | 606 to the GnuplotHelper and to the FileHelper: |
602 | 607 |
603 - BooleanProbe | 608 - BooleanProbe |
604 - DoubleProbe | 609 - DoubleProbe |
605 - Uinteger8Probe | 610 - Uinteger8Probe |
606 - Uinteger16Probe | 611 - Uinteger16Probe |
607 - Uinteger32Probe | 612 - Uinteger32Probe |
608 - TimeProbe | 613 - TimeProbe |
609 - PacketProbe | 614 - PacketProbe |
610 - ApplicationPacketProbe | 615 - ApplicationPacketProbe |
611 - Ipv4PacketProbe | 616 - Ipv4PacketProbe |
612 | 617 |
613 These Probes, therefore, are the only TypeIds available to be used· | 618 These Probes, therefore, are the only TypeIds available to be used· |
614 in ``PlotProbe()`` and ``WriteProbe()``. | 619 in `AddProbe()``. |
615 | 620 |
616 In the next few sections, we cover each of the fundamental object | 621 In the next few sections, we cover each of the fundamental object |
617 types (Probe, Collector, and Aggregator) in more detail, and show | 622 types (Probe, Collector, and Aggregator) in more detail, and show |
618 how they can be connected together using lower-level API. | 623 how they can be connected together using lower-level API. |
OLD | NEW |