Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 1 | |
| 2 | Obtaining metrics |
| 3 | ================= |
| 4 | |
| 5 | To obtain simulation results, you would need to connect to one or more `trace sources <doxygen/group___trace_source_list.html>`_ provided by ndnSIM classes. |
| 6 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 7 | It is also possible to use existing trace helpers, which collects and aggregates requested statistical information in text files. |
| 8 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 9 | .. _trace classes: |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 10 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 11 | Packet-level trace helpers |
| 12 | -------------------------- |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 13 | |
| 14 | - :ndnsim:`ndn::L3AggregateTracer` |
| 15 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 16 | Tracing the aggregate number of Interests/Data packets forwarded by an NDN node |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 17 | |
| 18 | The following example enables tracing on all simulation nodes: |
| 19 | |
| 20 | .. code-block:: c++ |
| 21 | |
| 22 | // the following should be put just before calling Simulator::Run in the scenario |
| 23 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 24 | ndn::L3AggregateTracer::InstallAll ("aggregate-trace.txt", Seconds (1.0)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 25 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 26 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 27 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 28 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 29 | |
| 30 | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame^] | 31 | Output file format is tab-separated values, with first row specifying names of the columns. Refer to the following table for the description of the columns: |
| 32 | |
| 33 | +------------------+---------------------------------------------------------------------+ |
| 34 | | Column | Description | |
| 35 | +==================+=====================================================================+ |
| 36 | | ``Time`` | simulation time | |
| 37 | +------------------+---------------------------------------------------------------------+ |
| 38 | | ``Node`` | node id, globally unique | |
| 39 | +------------------+---------------------------------------------------------------------+ |
| 40 | | ``FaceId`` | interface ID (-1 for combined metric) | |
| 41 | +------------------+---------------------------------------------------------------------+ |
| 42 | | ``Type`` | Type of measurements: | |
| 43 | | | | |
| 44 | | | - ``InInterests`` measurements of incoming Interests | |
| 45 | | | - ``OutInterests`` measurements of outgoing Interests | |
| 46 | | | - ``DropInterests`` measurements of dropped Interests | |
| 47 | | | - ``InData`` measurements of incoming Data | |
| 48 | | | - ``OutData`` measurements of outgoing Data | |
| 49 | | | - ``DropData`` measurements of dropped Data | |
| 50 | | | - ``InNacks`` measurements of incoming NACKs | |
| 51 | | | - ``OutNacks`` measurements of outgoing NACKs | |
| 52 | | | - ``DropNacks`` measurements of dropped NACKs | |
| 53 | | | - ``SatisfiedInterests`` measurements of satisfied Interests | |
| 54 | | | - ``TimedOutInterests`` measurements of timed out Interests | |
| 55 | +------------------+---------------------------------------------------------------------+ |
| 56 | | ``Packets`` | absolute number of packets within last averaging period | |
| 57 | | | (number of packets). | |
| 58 | +------------------+---------------------------------------------------------------------+ |
| 59 | | ``Kilobytes`` | absolute number of kilobytes transferred within the last averaging | |
| 60 | | | period (number of packets). | |
| 61 | +------------------+---------------------------------------------------------------------+ |
| 62 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 63 | - :ndnsim:`ndn::L3RateTracer` |
| 64 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 65 | Tracing the rate in bytes and in number of packets of Interest/Data packets forwarded by an NDN node |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 66 | |
| 67 | The following example enables tracing on all simulation nodes: |
| 68 | |
| 69 | .. code-block:: c++ |
| 70 | |
| 71 | // the following should be put just before calling Simulator::Run in the scenario |
| 72 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 73 | ndn::L3RateTracer::InstallAll ("rate-trace.txt", Seconds (1.0)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 74 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 75 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 76 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 77 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 78 | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame^] | 79 | Output file format is tab-separated values, with first row specifying names of the columns. Refer to the following table for the description of the columns: |
| 80 | |
| 81 | +------------------+---------------------------------------------------------------------+ |
| 82 | | Column | Description | |
| 83 | +==================+=====================================================================+ |
| 84 | | ``Time`` | simulation time | |
| 85 | +------------------+---------------------------------------------------------------------+ |
| 86 | | ``Node`` | node id, globally unique | |
| 87 | +------------------+---------------------------------------------------------------------+ |
| 88 | | ``FaceId`` | interface ID (-1 for combined metric) | |
| 89 | +------------------+---------------------------------------------------------------------+ |
| 90 | | ``Type`` | Type of measurements: | |
| 91 | | | | |
| 92 | | | - ``InInterests`` measurements of incoming Interests | |
| 93 | | | - ``OutInterests`` measurements of outgoing Interests | |
| 94 | | | - ``DropInterests`` measurements of dropped Interests | |
| 95 | | | - ``InData`` measurements of incoming Data | |
| 96 | | | - ``OutData`` measurements of outgoing Data | |
| 97 | | | - ``DropData`` measurements of dropped Data | |
| 98 | | | - ``InNacks`` measurements of incoming NACKs | |
| 99 | | | - ``OutNacks`` measurements of outgoing NACKs | |
| 100 | | | - ``DropNacks`` measurements of dropped NACKs | |
| 101 | | | - ``InSatisfiedInterests`` measurements of incoming satisfied | |
| 102 | | | Interests | |
| 103 | | | - ``InTimedOutInterests`` measurements of incoming timed out | |
| 104 | | | Interests | |
| 105 | | | - ``OutSatisfiedInterests`` measurements of outgoing satisfied | |
| 106 | | | Interests | |
| 107 | | | - ``OutTimedOutInterests`` measurements of outgoing satisfied | |
| 108 | | | Interests | |
| 109 | +------------------+---------------------------------------------------------------------+ |
| 110 | | ``Packets`` | estimated rate (EWMA average) of packets within the last averaging | |
| 111 | | | period (number of packets/s). | |
| 112 | +------------------+---------------------------------------------------------------------+ |
| 113 | | ``Kilobytes`` | estimated rate (EWMA average) within last averaging | |
| 114 | | | period (kilobytes/s) | |
| 115 | +------------------+---------------------------------------------------------------------+ |
| 116 | | ``PacketsRaw`` | absolute number of packets within last averaging period | |
| 117 | | | (number of packets). | |
| 118 | +------------------+---------------------------------------------------------------------+ |
| 119 | | ``KilobytesRaw`` | absolute number of kilobytes transferred within the last averaging | |
| 120 | | | period (number of packets). | |
| 121 | +------------------+---------------------------------------------------------------------+ |
| 122 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 123 | - :ndnsim:`L2Tracer` |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 124 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 125 | This tracer is similar in spirit to :ndnsim:`ndn::L3RateTracer`, but it currently traces only packet drop on layer 2 (e.g., |
| 126 | due to transmission queue overflow). |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 127 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 128 | The following example enables tracing on all simulation nodes: |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 129 | |
| 130 | .. code-block:: c++ |
| 131 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 132 | // the following should be put just before calling Simulator::Run in the scenario |
| 133 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 134 | L2RateTracer::InstallAll ("drop-trace.txt", Seconds (0.5)); |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 135 | |
| 136 | Simulator::Run (); |
| 137 | |
| 138 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 139 | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame^] | 140 | Output file format is tab-separated values, with first row specifying names of the columns. Refer to the following table for the description of the columns: |
| 141 | |
| 142 | +------------------+---------------------------------------------------------------------+ |
| 143 | | Column | Description | |
| 144 | +==================+=====================================================================+ |
| 145 | | ``Time`` | simulation time | |
| 146 | +------------------+---------------------------------------------------------------------+ |
| 147 | | ``Node`` | node id, globally unique | |
| 148 | +------------------+---------------------------------------------------------------------+ |
| 149 | | ``Interface`` | interface name (currently only "combined") | |
| 150 | +------------------+---------------------------------------------------------------------+ |
| 151 | | ``Type`` | Type of measurements: | |
| 152 | | | | |
| 153 | | | - ``Drop`` measurements of dropped packets | |
| 154 | +------------------+---------------------------------------------------------------------+ |
| 155 | | ``Packets`` | estimated rate (EWMA average) of packets within the last averaging | |
| 156 | | | period (number of packets/s). | |
| 157 | +------------------+---------------------------------------------------------------------+ |
| 158 | | ``Kilobytes`` | estimated rate (EWMA average) within last averaging | |
| 159 | | | period (kilobytes/s) | |
| 160 | +------------------+---------------------------------------------------------------------+ |
| 161 | | ``PacketsRaw`` | absolute number of packets within last averaging period | |
| 162 | | | (number of packets). | |
| 163 | +------------------+---------------------------------------------------------------------+ |
| 164 | | ``KilobytesRaw`` | absolute number of kilobytes transferred within the last averaging | |
| 165 | | | period (number of packets). | |
| 166 | +------------------+---------------------------------------------------------------------+ |
| 167 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 168 | .. note:: |
| 169 | |
| 170 | A number of other tracers are available in ``plugins/tracers-broken`` folder, but they do not yet work with the current code. |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 171 | Eventually, we will port most of them to the current code, but it is not our main priority at the moment and would really appreciate help with writing new tracers and porting the old ones. |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 172 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 173 | .. _packet trace helper example: |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 174 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 175 | Example of packet-level trace helpers |
| 176 | +++++++++++++++++++++++++++++++++++++ |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 177 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 178 | This example (``ndn-tree-tracers.cc``) demonstrates basic usage of :ref:`trace classes`. |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 179 | |
| 180 | In this scenario we will use a tree-like topology, where consumers are installed on leaf nodes and producer is in the root of the tree: |
| 181 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 182 | .. sidebar:: Topology |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 183 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 184 | .. aafig:: |
| 185 | :aspect: 60 |
| 186 | :scale: 100 |
| 187 | |
| 188 | /--------\ /--------\ /--------\ /--------\ |
| 189 | |"leaf-1"| |"leaf-2"| |"leaf-3"| |"leaf-4"| |
| 190 | \--------/ \--------/ \--------/ \--------/ |
| 191 | ^ ^ ^ ^ |
| 192 | | | | | |
| 193 | \ / \ / |
| 194 | \ / \ / 10Mbps / 1ms |
| 195 | \ / \ / |
| 196 | | | | | |
| 197 | v v v v |
| 198 | /-------\ /-------\ |
| 199 | |"rtr-1"| |"rtr-2"| |
| 200 | \-------/ \-------/ |
| 201 | ^ ^ |
| 202 | | | |
| 203 | \ / 10 Mpbs / 1ms |
| 204 | +--------\ /--------+ |
| 205 | | | |
| 206 | v v |
| 207 | /--------\ |
| 208 | | "root" | |
| 209 | \--------/ |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 210 | |
| 211 | The corresponding topology file (``topo-tree.txt``): |
| 212 | |
| 213 | .. literalinclude:: ../../examples/topologies/topo-tree.txt |
| 214 | :language: bash |
| 215 | :linenos: |
| 216 | :lines: 1-2,27- |
| 217 | |
| 218 | Example simulation (``ndn-tree-tracers.cc``) scenario that utilizes trace helpers: |
| 219 | |
| 220 | .. literalinclude:: ../../examples/ndn-tree-tracers.cc |
| 221 | :language: c++ |
| 222 | :linenos: |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 223 | :lines: 21-28,61- |
| 224 | :emphasize-lines: 57-58 |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 225 | |
| 226 | To run this scenario, use the following command:: |
| 227 | |
| 228 | ./waf --run=ndn-tree-tracers |
| 229 | |
| 230 | The successful run will create ``rate-trace.txt`` and ``aggregate-trace.txt`` files in the current directly, which can be analyzed manually or used as input to some graph/stats packages. |
| 231 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 232 | .. sidebar:: Graph build using the `R script <http://www.r-project.org/>`_ |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 233 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 234 | .. image:: _static/root-rates.png |
| 235 | :alt: Interest/Data packet rates at the root node |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 236 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 237 | .. image:: _static/root-5sec-counts.png |
| 238 | :alt: Interest/Data packet counts at the root node in 5-second intervals |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 239 | |
| 240 | .. literalinclude:: ../../examples/graphs/rate-graph.R |
| 241 | :language: r |
| 242 | :linenos: |
| 243 | |
| 244 | For more information about R and ggplot2, please refer to `R language manual <http://cran.r-project.org/manuals.html>`_, `ggplot2 module manual <http://docs.ggplot2.org/current/>`_. |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 245 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 246 | .. _Example of packet drop tracer (L2Tracer): |
| 247 | |
| 248 | Example of packet drop tracer (L2Tracer) |
| 249 | ---------------------------------------- |
| 250 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 251 | .. sidebar:: Topology |
| 252 | |
| 253 | .. image:: _static/topo-tree-25-node.png |
| 254 | :alt: 25-node tree topology |
| 255 | :width: 550px |
| 256 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 257 | This example (``ndn-tree-with-l2tracer.cc``) demonstrates basic usage of :ref:`trace classes`. |
| 258 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 259 | The corresponding topology file (``topo-tree-25-node.txt``): |
| 260 | |
| 261 | .. literalinclude:: ../../examples/topologies/topo-tree-25-node.txt |
| 262 | :language: bash |
| 263 | :linenos: |
| 264 | :lines: 2- |
| 265 | |
| 266 | Example simulation (``ndn-tree-with-l2tracer.cc``) scenario that utilizes trace helpers: |
| 267 | |
| 268 | .. literalinclude:: ../../examples/ndn-tree-with-l2tracer.cc |
| 269 | :language: c++ |
| 270 | :linenos: |
| 271 | :lines: 1- |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 272 | :emphasize-lines: 16,135 |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 273 | |
| 274 | To run this scenario, use the following command:: |
| 275 | |
| 276 | ./waf --run=ndn-tree-with-l2tracer |
| 277 | |
| 278 | The successful run will create ``drop-trace.txt`` file in the current directly, which can be analyzed manually or used as input to some graph/stats packages. |
| 279 | |
| 280 | For example, the following `R script <http://www.r-project.org/>`_ will build a number of nice graphs: |
| 281 | |
| 282 | .. literalinclude:: ../../examples/graphs/drop-graph.R |
| 283 | :language: r |
| 284 | :linenos: |
| 285 | |
| 286 | .. image:: _static/l2-rate-tracer.png |
| 287 | :alt: Packet drop rates on routers |
| 288 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 289 | .. _cs trace helper: |
| 290 | |
| 291 | Content store trace helper |
| 292 | -------------------------- |
| 293 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 294 | - :ndnsim:`ndn::CsTracer` |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 295 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 296 | With the use of :ndnsim:`ndn::CsTracer` it is possible to obtain statistics of cache hits/cache misses on simulation nodes. |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 297 | |
| 298 | The following code enables content store tracing: |
| 299 | |
| 300 | .. code-block:: c++ |
| 301 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 302 | // the following should be put just before calling Simulator::Run in the scenario |
| 303 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 304 | ndn::CsTracer::InstallAll ("cs-trace.txt", Seconds (1)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 305 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 306 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 307 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 308 | ... |
| 309 | |
| 310 | .. - Tracing lifetime of content store entries |
| 311 | |
| 312 | .. Evaluate lifetime of the content store entries can be accomplished using modified version of the content stores. |
| 313 | .. In particular, |
| 314 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 315 | .. _cs trace helper example: |
| 316 | |
| 317 | Example of content store trace helper |
| 318 | +++++++++++++++++++++++++++++++++++++ |
| 319 | |
| 320 | This example (``ndn-tree-cs-tracers.cc``) demonstrates basic usage of content store tracer. |
| 321 | |
| 322 | In this scenario we will use the same tree-like topology as in :ref:`previous example <packet trace helper example>`, where consumers are installed on leaf nodes and producer is in the root of the tree. |
| 323 | The main difference is that each client request data from the same namespace: /root/1, /root/2, ... Another small difference is that in this scenario we start our application not at the same time, but 10 ms apart. |
| 324 | |
| 325 | Example simulation (``ndn-tree-cs-tracers.cc``) scenario that utilizes trace helpers: |
| 326 | |
| 327 | .. literalinclude:: ../../examples/ndn-tree-cs-tracers.cc |
| 328 | :language: c++ |
| 329 | :linenos: |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 330 | :lines: 21-28,61- |
| 331 | :emphasize-lines: 59 |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 332 | |
| 333 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 334 | To run this scenario, use the following command:: |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 335 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 336 | ./waf --run=ndn-tree-cs-tracers |
| 337 | |
| 338 | The successful run will create ``cs-trace.txt``, which similarly to trace file from the :ref:`tracing example <packet trace helper example>` can be analyzed manually or used as input to some graph/stats packages. |
| 339 | |
| 340 | |
| 341 | Application-level trace helper |
| 342 | ------------------------------ |
| 343 | |
| 344 | - :ndnsim:`ndn::AppDelayTracer` |
| 345 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 346 | With the use of :ndnsim:`ndn::AppDelayTracer` it is possible to obtain data about for delays between issuing Interest and receiving corresponding Data packet. |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 347 | |
| 348 | The following code enables application-level Interest-Data delay tracing: |
| 349 | |
| 350 | .. code-block:: c++ |
| 351 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 352 | // the following should be put just before calling Simulator::Run in the scenario |
| 353 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 354 | ndn::AppDelayTracer::InstallAll ("app-delays-trace.txt"); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 355 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 356 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 357 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 358 | ... |
| 359 | |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 360 | Output file format is tab-separated values, with first row specifying names of the columns. Refer to the following table for the description of the columns: |
| 361 | |
| 362 | +-----------------+---------------------------------------------------------------------+ |
| 363 | | Column | Description | |
| 364 | +=================+=====================================================================+ |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 365 | | ``Time`` | simulation time when SeqNo was receivied | |
| 366 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 367 | | ``Node`` | node id, global unique | |
| 368 | +-----------------+---------------------------------------------------------------------+ |
| 369 | | ``AppId`` | app id, local unique on the node, not global | |
| 370 | +-----------------+---------------------------------------------------------------------+ |
| 371 | | ``SeqNo`` | seq number of the Interest-Data | |
| 372 | +-----------------+---------------------------------------------------------------------+ |
| 373 | | ``Type`` | Type of delay: | |
| 374 | | | | |
| 375 | | | - ``LastDelay`` means that ``DelayS`` and ``DelayUS`` represent | |
| 376 | | | delay between last Interest sent and Data packet received | |
| 377 | | | - ``FullDelay`` means that ``DelayS`` and ``DelayUS`` represent | |
| 378 | | | delay between first Interest sent and Data packet received | |
| 379 | | | (i.e., includes time of Interest retransmissions) | |
| 380 | +-----------------+---------------------------------------------------------------------+ |
| 381 | | ``DelayS`` | delay value, specified in seconds | |
| 382 | +-----------------+---------------------------------------------------------------------+ |
| 383 | | ``DelayUS`` | delay value, specified in microseconds (10^-6) | |
| 384 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 400aae1 | 2013-01-19 13:27:52 -0800 | [diff] [blame] | 385 | | ``RetxCount`` | number of Interest retransmissions (for LastDelay always equal to 1)| |
| 386 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 387 | | ``HopCount`` | combined number of number of hops for Interest and Data packet. | |
| 388 | | | Note that HopCount is increased anytime somebody calls Send method | |
| 389 | | | on a face, including delivery of Interest/Data to application via | |
| 390 | | | an AppFace (but not from application to ndn::L3Protocol!). | |
| 391 | | | | |
| 392 | | | One consequence is that Interests satisfied by an app will have | |
| 393 | | | even hop count (min hop count = 2), and Interests satisfied from | |
Alexander Afanasyev | 4e30a8f | 2013-11-21 19:55:49 -0800 | [diff] [blame] | 394 | | | caches will have odd hop count (min hop count = 1) | |
Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 395 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 396 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 397 | .. _app delay trace helper example: |
| 398 | |
| 399 | Example of application-level trace helper |
| 400 | +++++++++++++++++++++++++++++++++++++++++ |
| 401 | |
| 402 | This example (``ndn-tree-app-delay-tracer.cc``) demonstrates basic usage of application-level Interest-Data delay tracer. |
| 403 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 404 | In this scenario we will use the same tree-like topology as in :ref:`packet trace helper example <packet trace helper example>`, where consumers are installed on leaf nodes and producer is in the root of the tree and clients request data from the same namespace: /root/1, /root/2, ... |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 405 | |
| 406 | Example simulation (``ndn-tree-app-delay-tracer.cc``) scenario that utilizes trace helpers: |
| 407 | |
| 408 | .. literalinclude:: ../../examples/ndn-tree-app-delay-tracer.cc |
| 409 | :language: c++ |
| 410 | :linenos: |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 411 | :lines: 21-28,61- |
| 412 | :emphasize-lines: 59 |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 413 | |
| 414 | |
| 415 | To run this scenario, use the following command:: |
| 416 | |
| 417 | ./waf --run=ndn-tree-app-delay-tracer |
| 418 | |
| 419 | The successful run will create ``app-delays-trace.txt``, which similarly to trace file from the :ref:`packet trace helper example <packet trace helper example>` can be analyzed manually or used as input to some graph/stats packages. |
| 420 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 421 | |
Alexander Afanasyev | b5e77d8 | 2013-04-10 15:55:26 -0700 | [diff] [blame] | 422 | Other types of stats |
| 423 | -------------------- |
| 424 | |
| 425 | .. _periodic tracing of Pending Interest Table (PIT) size: |
| 426 | |
| 427 | Periodic tracing of Pending Interest Table (PIT) size |
| 428 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 429 | |
| 430 | This example (``ndn-simple-with-pit-count-stats.cc``) shows how you can periodically print out current size of PIT on the selected nodes. |
| 431 | |
| 432 | .. literalinclude:: ../../examples/ndn-simple-with-pit-count-stats.cc |
| 433 | :language: c++ |
| 434 | :linenos: |
| 435 | :lines: 20-26,47- |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 436 | :emphasize-lines: 9-20,43-46,59-61 |
Alexander Afanasyev | b5e77d8 | 2013-04-10 15:55:26 -0700 | [diff] [blame] | 437 | |
| 438 | To run this scenario, use the following command:: |
| 439 | |
| 440 | ./waf --run=ndn-simple-with-pit-count-stats |