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 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 14 | - :ndnsim:`ndn::L3RateTracer` |
| 15 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 16 | 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] | 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 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 24 | L3RateTracer::InstallAll("rate-trace.txt", Seconds(1.0)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 25 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -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 | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 30 | 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: |
| 31 | |
| 32 | +------------------+---------------------------------------------------------------------+ |
| 33 | | Column | Description | |
| 34 | +==================+=====================================================================+ |
| 35 | | ``Time`` | simulation time | |
| 36 | +------------------+---------------------------------------------------------------------+ |
| 37 | | ``Node`` | node id, globally unique | |
| 38 | +------------------+---------------------------------------------------------------------+ |
| 39 | | ``FaceId`` | interface ID (-1 for combined metric) | |
| 40 | +------------------+---------------------------------------------------------------------+ |
| 41 | | ``Type`` | Type of measurements: | |
| 42 | | | | |
| 43 | | | - ``InInterests`` measurements of incoming Interests | |
| 44 | | | - ``OutInterests`` measurements of outgoing Interests | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 45 | | | - ``InData`` measurements of incoming Data | |
| 46 | | | - ``OutData`` measurements of outgoing Data | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 47 | | | - ``SatisfiedInterests`` measurements of satisfied Interests | |
| 48 | | | (totals for all faces) | |
| 49 | | | - ``TimedOutInterests`` measurements of timed out Interests | |
| 50 | | | (totals for all faces) | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 51 | | | - ``InSatisfiedInterests`` measurements of incoming satisfied | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 52 | | | Interests (per incoming face) | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 53 | | | - ``InTimedOutInterests`` measurements of incoming timed out | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 54 | | | Interests (per incoming face) | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 55 | | | - ``OutSatisfiedInterests`` measurements of outgoing satisfied | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 56 | | | Interests (per outgoing face) | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 57 | | | - ``OutTimedOutInterests`` measurements of outgoing satisfied | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 58 | | | Interests (per outgoing face) | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 59 | +------------------+---------------------------------------------------------------------+ |
| 60 | | ``Packets`` | estimated rate (EWMA average) of packets within the last averaging | |
| 61 | | | period (number of packets/s). | |
| 62 | +------------------+---------------------------------------------------------------------+ |
| 63 | | ``Kilobytes`` | estimated rate (EWMA average) within last averaging | |
| 64 | | | period (kilobytes/s) | |
| 65 | +------------------+---------------------------------------------------------------------+ |
| 66 | | ``PacketsRaw`` | absolute number of packets within last averaging period | |
| 67 | | | (number of packets). | |
| 68 | +------------------+---------------------------------------------------------------------+ |
| 69 | | ``KilobytesRaw`` | absolute number of kilobytes transferred within the last averaging | |
| 70 | | | period (number of packets). | |
| 71 | +------------------+---------------------------------------------------------------------+ |
| 72 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 73 | - :ndnsim:`L2Tracer` |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 74 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 75 | This tracer is similar in spirit to :ndnsim:`ndn::L3RateTracer`, but it currently traces only packet drop on layer 2 (e.g., |
| 76 | due to transmission queue overflow). |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 77 | |
Alexander Afanasyev | 3fe94dc | 2013-08-09 17:12:12 -0700 | [diff] [blame] | 78 | The following example enables tracing on all simulation nodes: |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 79 | |
| 80 | .. code-block:: c++ |
| 81 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 82 | // the following should be put just before calling Simulator::Run in the scenario |
| 83 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 84 | L2RateTracer::InstallAll("drop-trace.txt", Seconds(0.5)); |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 85 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 86 | Simulator::Run(); |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 87 | |
| 88 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 89 | |
Alexander Afanasyev | 4597741 | 2014-03-11 13:21:46 -0700 | [diff] [blame] | 90 | 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: |
| 91 | |
| 92 | +------------------+---------------------------------------------------------------------+ |
| 93 | | Column | Description | |
| 94 | +==================+=====================================================================+ |
| 95 | | ``Time`` | simulation time | |
| 96 | +------------------+---------------------------------------------------------------------+ |
| 97 | | ``Node`` | node id, globally unique | |
| 98 | +------------------+---------------------------------------------------------------------+ |
| 99 | | ``Interface`` | interface name (currently only "combined") | |
| 100 | +------------------+---------------------------------------------------------------------+ |
| 101 | | ``Type`` | Type of measurements: | |
| 102 | | | | |
| 103 | | | - ``Drop`` measurements of dropped packets | |
| 104 | +------------------+---------------------------------------------------------------------+ |
| 105 | | ``Packets`` | estimated rate (EWMA average) of packets within the last averaging | |
| 106 | | | period (number of packets/s). | |
| 107 | +------------------+---------------------------------------------------------------------+ |
| 108 | | ``Kilobytes`` | estimated rate (EWMA average) within last averaging | |
| 109 | | | period (kilobytes/s) | |
| 110 | +------------------+---------------------------------------------------------------------+ |
| 111 | | ``PacketsRaw`` | absolute number of packets within last averaging period | |
| 112 | | | (number of packets). | |
| 113 | +------------------+---------------------------------------------------------------------+ |
| 114 | | ``KilobytesRaw`` | absolute number of kilobytes transferred within the last averaging | |
| 115 | | | period (number of packets). | |
| 116 | +------------------+---------------------------------------------------------------------+ |
| 117 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 118 | .. note:: |
| 119 | |
| 120 | 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] | 121 | 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] | 122 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 123 | .. _packet trace helper example: |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 124 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 125 | Example of packet-level trace helpers |
| 126 | +++++++++++++++++++++++++++++++++++++ |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 127 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 128 | This example (``ndn-tree-tracers.cpp``) demonstrates basic usage of :ref:`trace classes`. |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 129 | |
| 130 | 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: |
| 131 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 132 | .. sidebar:: Topology |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 133 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 134 | .. aafig:: |
| 135 | :aspect: 60 |
| 136 | :scale: 100 |
| 137 | |
| 138 | /--------\ /--------\ /--------\ /--------\ |
| 139 | |"leaf-1"| |"leaf-2"| |"leaf-3"| |"leaf-4"| |
| 140 | \--------/ \--------/ \--------/ \--------/ |
| 141 | ^ ^ ^ ^ |
| 142 | | | | | |
| 143 | \ / \ / |
| 144 | \ / \ / 10Mbps / 1ms |
| 145 | \ / \ / |
| 146 | | | | | |
| 147 | v v v v |
| 148 | /-------\ /-------\ |
| 149 | |"rtr-1"| |"rtr-2"| |
| 150 | \-------/ \-------/ |
| 151 | ^ ^ |
| 152 | | | |
| 153 | \ / 10 Mpbs / 1ms |
| 154 | +--------\ /--------+ |
| 155 | | | |
| 156 | v v |
| 157 | /--------\ |
| 158 | | "root" | |
| 159 | \--------/ |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 160 | |
| 161 | The corresponding topology file (``topo-tree.txt``): |
| 162 | |
| 163 | .. literalinclude:: ../../examples/topologies/topo-tree.txt |
| 164 | :language: bash |
| 165 | :linenos: |
| 166 | :lines: 1-2,27- |
| 167 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 168 | Example simulation (``ndn-tree-tracers.cpp``) scenario that utilizes trace helpers: |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 169 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 170 | .. literalinclude:: ../../examples/ndn-tree-tracers.cpp |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 171 | :language: c++ |
| 172 | :linenos: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 173 | :lines: 20-27,60- |
| 174 | :emphasize-lines: 58 |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 175 | |
| 176 | To run this scenario, use the following command:: |
| 177 | |
| 178 | ./waf --run=ndn-tree-tracers |
| 179 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 180 | The successful run will create ``rate-trace.txt`` files in the current directly, which can be analyzed manually or used as input to some graph/stats packages. |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 181 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 182 | .. sidebar:: Graph build using the `R script <http://www.r-project.org/>`_ |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 183 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 184 | .. image:: _static/root-rates.png |
| 185 | :alt: Interest/Data packet rates at the root node |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 186 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 187 | .. literalinclude:: ../../examples/graphs/rate-graph.R |
| 188 | :language: r |
| 189 | :linenos: |
| 190 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 191 | For more information about R and ggplot2, please refer to `R language manual <http://cran.r-project.org/manuals.html>`_ and `ggplot2 module manual <http://docs.ggplot2.org/current/>`_. |
| 192 | |
| 193 | :: |
| 194 | |
| 195 | Rscript src/ndnSIM/examples/graphs/rate-graph.R |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 196 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 197 | .. _Example of packet drop tracer (L2Tracer): |
| 198 | |
| 199 | Example of packet drop tracer (L2Tracer) |
| 200 | ---------------------------------------- |
| 201 | |
Alexander Afanasyev | fc9d9e1 | 2013-08-10 14:17:49 -0700 | [diff] [blame] | 202 | .. sidebar:: Topology |
| 203 | |
| 204 | .. image:: _static/topo-tree-25-node.png |
| 205 | :alt: 25-node tree topology |
| 206 | :width: 550px |
| 207 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 208 | This example (``ndn-tree-with-l2tracer.cpp``) demonstrates basic usage of :ref:`trace classes`. |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 209 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 210 | The corresponding topology file (``topo-tree-25-node.txt``): |
| 211 | |
| 212 | .. literalinclude:: ../../examples/topologies/topo-tree-25-node.txt |
| 213 | :language: bash |
| 214 | :linenos: |
| 215 | :lines: 2- |
| 216 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 217 | Example simulation (``ndn-tree-with-l2tracer.cpp``) scenario that utilizes trace helpers: |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 218 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 219 | .. literalinclude:: ../../examples/ndn-tree-with-l2tracer.cpp |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 220 | :language: c++ |
| 221 | :linenos: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 222 | :lines: 20- |
| 223 | :emphasize-lines: 16,134 |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 224 | |
| 225 | To run this scenario, use the following command:: |
| 226 | |
| 227 | ./waf --run=ndn-tree-with-l2tracer |
| 228 | |
| 229 | 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. |
| 230 | |
| 231 | For example, the following `R script <http://www.r-project.org/>`_ will build a number of nice graphs: |
| 232 | |
| 233 | .. literalinclude:: ../../examples/graphs/drop-graph.R |
| 234 | :language: r |
| 235 | :linenos: |
| 236 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 237 | Run R script:: |
| 238 | |
| 239 | Rscript src/ndnSIM/examples/graphs/drop-graph.R |
| 240 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 241 | .. image:: _static/l2-rate-tracer.png |
| 242 | :alt: Packet drop rates on routers |
| 243 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 244 | .. _cs trace helper: |
| 245 | |
| 246 | Content store trace helper |
| 247 | -------------------------- |
| 248 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 249 | NOTE: This tracer works ONLY when the content store structure of ndnSIM is used! |
| 250 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 251 | - :ndnsim:`ndn::CsTracer` |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 252 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 253 | 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] | 254 | |
| 255 | The following code enables content store tracing: |
| 256 | |
| 257 | .. code-block:: c++ |
| 258 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 259 | // the following should be put just before calling Simulator::Run in the scenario |
| 260 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 261 | CsTracer::InstallAll("cs-trace.txt", Seconds(1)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 262 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 263 | Simulator::Run(); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 264 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 265 | ... |
| 266 | |
Alexander Afanasyev | 02bf777 | 2016-08-04 13:58:05 -0700 | [diff] [blame] | 267 | 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: |
| 268 | |
| 269 | +------------------+----------------------------------------------------------------------+ |
| 270 | | Column | Description | |
| 271 | +==================+======================================================================+ |
| 272 | | ``Time`` | simulation time | |
| 273 | +------------------+----------------------------------------------------------------------+ |
| 274 | | ``Node`` | node id, globally unique | |
| 275 | +------------------+----------------------------------------------------------------------+ |
| 276 | | ``Type`` | Type of counter for the time period. Possible values are: | |
| 277 | | | | |
| 278 | | | - ``CacheHits``: the ``Packets`` column specifies the number of | |
| 279 | | | Interests that were satisfied from the cache | |
| 280 | | | - ``CacheMisses``: the ``Packets`` column specifies the number of | |
| 281 | | | Interests that were not satisfied from the cache | |
| 282 | +------------------+----------------------------------------------------------------------+ |
| 283 | | ``Packets`` | The number of packets for the time period, meaning depends on | |
| 284 | | | ``Type`` column | |
| 285 | +------------------+----------------------------------------------------------------------+ |
| 286 | |
| 287 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 288 | .. - Tracing lifetime of content store entries |
| 289 | |
| 290 | .. Evaluate lifetime of the content store entries can be accomplished using modified version of the content stores. |
| 291 | .. In particular, |
| 292 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 293 | .. _cs trace helper example: |
| 294 | |
| 295 | Example of content store trace helper |
| 296 | +++++++++++++++++++++++++++++++++++++ |
| 297 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 298 | This example (``ndn-tree-cs-tracers.cpp``) demonstrates basic usage of content store tracer. |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 299 | |
| 300 | 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. |
| 301 | 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. |
| 302 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 303 | Example simulation (``ndn-tree-cs-tracers.cpp``) scenario that utilizes trace helpers: |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 304 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 305 | .. literalinclude:: ../../examples/ndn-tree-cs-tracers.cpp |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 306 | :language: c++ |
| 307 | :linenos: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 308 | :lines: 20-27,60- |
| 309 | :emphasize-lines: 61 |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 310 | |
| 311 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 312 | To run this scenario, use the following command:: |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 313 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 314 | ./waf --run=ndn-tree-cs-tracers |
| 315 | |
| 316 | 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. |
| 317 | |
| 318 | |
| 319 | Application-level trace helper |
| 320 | ------------------------------ |
| 321 | |
| 322 | - :ndnsim:`ndn::AppDelayTracer` |
| 323 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 324 | 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] | 325 | |
| 326 | The following code enables application-level Interest-Data delay tracing: |
| 327 | |
| 328 | .. code-block:: c++ |
| 329 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 330 | // the following should be put just before calling Simulator::Run in the scenario |
| 331 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 332 | AppDelayTracer::InstallAll("app-delays-trace.txt"); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 333 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 334 | Simulator::Run(); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 335 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 336 | ... |
| 337 | |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 338 | 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: |
| 339 | |
| 340 | +-----------------+---------------------------------------------------------------------+ |
| 341 | | Column | Description | |
| 342 | +=================+=====================================================================+ |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 343 | | ``Time`` | simulation time when SeqNo was receivied | |
| 344 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 345 | | ``Node`` | node id, global unique | |
| 346 | +-----------------+---------------------------------------------------------------------+ |
| 347 | | ``AppId`` | app id, local unique on the node, not global | |
| 348 | +-----------------+---------------------------------------------------------------------+ |
| 349 | | ``SeqNo`` | seq number of the Interest-Data | |
| 350 | +-----------------+---------------------------------------------------------------------+ |
| 351 | | ``Type`` | Type of delay: | |
| 352 | | | | |
| 353 | | | - ``LastDelay`` means that ``DelayS`` and ``DelayUS`` represent | |
| 354 | | | delay between last Interest sent and Data packet received | |
| 355 | | | - ``FullDelay`` means that ``DelayS`` and ``DelayUS`` represent | |
| 356 | | | delay between first Interest sent and Data packet received | |
| 357 | | | (i.e., includes time of Interest retransmissions) | |
| 358 | +-----------------+---------------------------------------------------------------------+ |
| 359 | | ``DelayS`` | delay value, specified in seconds | |
| 360 | +-----------------+---------------------------------------------------------------------+ |
| 361 | | ``DelayUS`` | delay value, specified in microseconds (10^-6) | |
| 362 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 400aae1 | 2013-01-19 13:27:52 -0800 | [diff] [blame] | 363 | | ``RetxCount`` | number of Interest retransmissions (for LastDelay always equal to 1)| |
| 364 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 18d8bc9 | 2015-08-13 18:26:40 -0700 | [diff] [blame] | 365 | | ``HopCount`` | the number of network hops that the retrieved Data packet traveled | |
| 366 | | | on the way back from producer application or cache. | |
| 367 | | | | |
| 368 | | | Note that semantics of ``HopCount`` field has changed compared to | |
| 369 | | | ndnSIM 1.0. | |
Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 370 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 371 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 372 | .. _app delay trace helper example: |
| 373 | |
| 374 | Example of application-level trace helper |
| 375 | +++++++++++++++++++++++++++++++++++++++++ |
| 376 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 377 | This example (``ndn-tree-app-delay-tracer.cpp``) demonstrates basic usage of application-level Interest-Data delay tracer. |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 378 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 379 | 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] | 380 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 381 | Example simulation (``ndn-tree-app-delay-tracer.cpp``) scenario that utilizes trace helpers: |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 382 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 383 | .. literalinclude:: ../../examples/ndn-tree-app-delay-tracer.cpp |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 384 | :language: c++ |
| 385 | :linenos: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 386 | :lines: 20-27,60- |
| 387 | :emphasize-lines: 60 |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 388 | |
| 389 | To run this scenario, use the following command:: |
| 390 | |
| 391 | ./waf --run=ndn-tree-app-delay-tracer |
| 392 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 393 | The successful run will create ``app-delays-trace.txt``, which similarly to trace file from the |
| 394 | :ref:`packet trace helper example <packet trace helper example>` can be analyzed manually or used as |
| 395 | input to some graph/stats packages. |