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