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 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 22 | // necessary includes |
| 23 | #include <ns3/ndnSIM/utils/tracers/ndn-l3-aggregate-tracer.h> |
| 24 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 25 | ... |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 26 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 27 | // the following should be put just before calling Simulator::Run in the scenario |
| 28 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 29 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3AggregateTracer> > > |
| 30 | aggTracers = ndn::L3AggregateTracer::InstallAll ("aggregate-trace.txt", Seconds (1.0)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 31 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 32 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 33 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 34 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 35 | |
| 36 | |
| 37 | - :ndnsim:`ndn::L3RateTracer` |
| 38 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 39 | 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] | 40 | |
| 41 | The following example enables tracing on all simulation nodes: |
| 42 | |
| 43 | .. code-block:: c++ |
| 44 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 45 | // necessary includes |
| 46 | #include <ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.h> |
| 47 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 48 | ... |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 49 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 50 | // the following should be put just before calling Simulator::Run in the scenario |
| 51 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 52 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3RateTracer> > > |
| 53 | rateTracers = ndn::L3RateTracer::InstallAll ("rate-trace.txt", Seconds (1.0)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 54 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 55 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 56 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 57 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 58 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 59 | - :ndnsim:`L2Tracer` |
| 60 | |
| 61 | This tracer is similar in spirit to :ndnsim:`ndn::L3RateTracer`, but it currently traces only packet drop on layer 2 (e.g., |
| 62 | due to transmission queue overflow). |
| 63 | |
| 64 | The following example enables tracing on all simulation nodes: |
| 65 | |
| 66 | .. code-block:: c++ |
| 67 | |
| 68 | // necessary includes |
| 69 | #include <ns3/ndnSIM/utils/tracers/l2-rate-tracer.h> |
| 70 | |
| 71 | ... |
| 72 | |
| 73 | // the following should be put just before calling Simulator::Run in the scenario |
| 74 | |
| 75 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L2RateTracer> > > |
| 76 | l2tracers = L2RateTracer::InstallAll ("drop-trace.txt", Seconds (0.5)); |
| 77 | |
| 78 | Simulator::Run (); |
| 79 | |
| 80 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 81 | |
| 82 | .. note:: |
| 83 | |
| 84 | 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] | 85 | 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] | 86 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 87 | .. _packet trace helper example: |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 88 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 89 | Example of packet-level trace helpers |
| 90 | +++++++++++++++++++++++++++++++++++++ |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 91 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 92 | 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] | 93 | |
| 94 | 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: |
| 95 | |
| 96 | .. aafig:: |
| 97 | :aspect: 60 |
| 98 | :scale: 120 |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 99 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 100 | /--------\ /--------\ /--------\ /--------\ |
| 101 | |"leaf-1"| |"leaf-2"| |"leaf-3"| |"leaf-4"| |
| 102 | \--------/ \--------/ \--------/ \--------/ |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 103 | ^ ^ ^ ^ |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 104 | | | | | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 105 | \ / \ / |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 106 | \ / \ / 10Mbps / 1ms |
| 107 | \ / \ / |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 108 | | | | | |
| 109 | v v v v |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 110 | /-------\ /-------\ |
| 111 | |"rtr-1"| |"rtr-2"| |
| 112 | \-------/ \-------/ |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 113 | ^ ^ |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 114 | | | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 115 | \ / 10 Mpbs / 1ms |
| 116 | +--------\ /--------+ |
| 117 | | | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 118 | v v |
| 119 | /--------\ |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 120 | | "root" | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 121 | \--------/ |
| 122 | |
| 123 | The corresponding topology file (``topo-tree.txt``): |
| 124 | |
| 125 | .. literalinclude:: ../../examples/topologies/topo-tree.txt |
| 126 | :language: bash |
| 127 | :linenos: |
| 128 | :lines: 1-2,27- |
| 129 | |
| 130 | Example simulation (``ndn-tree-tracers.cc``) scenario that utilizes trace helpers: |
| 131 | |
| 132 | .. literalinclude:: ../../examples/ndn-tree-tracers.cc |
| 133 | :language: c++ |
| 134 | :linenos: |
| 135 | :lines: 21-34,67- |
| 136 | :emphasize-lines: 7-11,63-67 |
| 137 | |
| 138 | |
| 139 | To run this scenario, use the following command:: |
| 140 | |
| 141 | ./waf --run=ndn-tree-tracers |
| 142 | |
| 143 | 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. |
| 144 | |
| 145 | For example, the following `R script <http://www.r-project.org/>`_ will build a number of nice graphs: |
| 146 | |
| 147 | .. image:: _static/root-rates.png |
| 148 | :alt: Interest/Data packet rates at the root node |
| 149 | :align: right |
| 150 | |
| 151 | .. image:: _static/root-5sec-counts.png |
| 152 | :alt: Interest/Data packet counts at the root node in 5-second intervals |
| 153 | :align: right |
| 154 | |
| 155 | .. literalinclude:: ../../examples/graphs/rate-graph.R |
| 156 | :language: r |
| 157 | :linenos: |
| 158 | |
| 159 | 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] | 160 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 161 | .. _Example of packet drop tracer (L2Tracer): |
| 162 | |
| 163 | Example of packet drop tracer (L2Tracer) |
| 164 | ---------------------------------------- |
| 165 | |
| 166 | This example (``ndn-tree-with-l2tracer.cc``) demonstrates basic usage of :ref:`trace classes`. |
| 167 | |
| 168 | In this scenario we will use a tree-like topology: |
| 169 | |
| 170 | .. image:: _static/topo-tree-25-node.png |
| 171 | :alt: 25-node tree topology |
| 172 | |
| 173 | The corresponding topology file (``topo-tree-25-node.txt``): |
| 174 | |
| 175 | .. literalinclude:: ../../examples/topologies/topo-tree-25-node.txt |
| 176 | :language: bash |
| 177 | :linenos: |
| 178 | :lines: 2- |
| 179 | |
| 180 | Example simulation (``ndn-tree-with-l2tracer.cc``) scenario that utilizes trace helpers: |
| 181 | |
| 182 | .. literalinclude:: ../../examples/ndn-tree-with-l2tracer.cc |
| 183 | :language: c++ |
| 184 | :linenos: |
| 185 | :lines: 1- |
| 186 | :emphasize-lines: 7-8,19,135-139 |
| 187 | |
| 188 | To run this scenario, use the following command:: |
| 189 | |
| 190 | ./waf --run=ndn-tree-with-l2tracer |
| 191 | |
| 192 | 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. |
| 193 | |
| 194 | For example, the following `R script <http://www.r-project.org/>`_ will build a number of nice graphs: |
| 195 | |
| 196 | .. literalinclude:: ../../examples/graphs/drop-graph.R |
| 197 | :language: r |
| 198 | :linenos: |
| 199 | |
| 200 | .. image:: _static/l2-rate-tracer.png |
| 201 | :alt: Packet drop rates on routers |
| 202 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 203 | .. _cs trace helper: |
| 204 | |
| 205 | Content store trace helper |
| 206 | -------------------------- |
| 207 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 208 | - :ndnsim:`ndn::CsTracer` |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 209 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 210 | 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] | 211 | |
| 212 | The following code enables content store tracing: |
| 213 | |
| 214 | .. code-block:: c++ |
| 215 | |
| 216 | // necessary includes |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 217 | #include <ns3/ndnSIM/utils/tracers/ndn-cs-tracer.h> |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 218 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 219 | ... |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 220 | |
| 221 | // Select implementation of content store. By default, the following is applied: |
| 222 | // ndnHelper.SetContentStore ("ns3::ndn::cs::Stats::Lru", "MaxSize", "100"); |
| 223 | |
| 224 | // the following should be put just before calling Simulator::Run in the scenario |
| 225 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame] | 226 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::CsTracer> > > |
| 227 | aggTracers = ndn::CsTracer::InstallAll ("cs-trace.txt", Seconds (1)); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 228 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 229 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 230 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 231 | ... |
| 232 | |
| 233 | .. - Tracing lifetime of content store entries |
| 234 | |
| 235 | .. Evaluate lifetime of the content store entries can be accomplished using modified version of the content stores. |
| 236 | .. In particular, |
| 237 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 238 | .. _cs trace helper example: |
| 239 | |
| 240 | Example of content store trace helper |
| 241 | +++++++++++++++++++++++++++++++++++++ |
| 242 | |
| 243 | This example (``ndn-tree-cs-tracers.cc``) demonstrates basic usage of content store tracer. |
| 244 | |
| 245 | 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. |
| 246 | 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. |
| 247 | |
| 248 | Example simulation (``ndn-tree-cs-tracers.cc``) scenario that utilizes trace helpers: |
| 249 | |
| 250 | .. literalinclude:: ../../examples/ndn-tree-cs-tracers.cc |
| 251 | :language: c++ |
| 252 | :linenos: |
| 253 | :lines: 21-31,64- |
| 254 | :emphasize-lines: 7-11,25,43,45,62-63 |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 255 | |
| 256 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 257 | To run this scenario, use the following command:: |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 258 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 259 | ./waf --run=ndn-tree-cs-tracers |
| 260 | |
| 261 | 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. |
| 262 | |
| 263 | |
| 264 | Application-level trace helper |
| 265 | ------------------------------ |
| 266 | |
| 267 | - :ndnsim:`ndn::AppDelayTracer` |
| 268 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 269 | 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] | 270 | |
| 271 | The following code enables application-level Interest-Data delay tracing: |
| 272 | |
| 273 | .. code-block:: c++ |
| 274 | |
| 275 | // necessary includes |
| 276 | #include <ns3/ndnSIM/utils/tracers/ndn-app-delay-tracer.h> |
| 277 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 278 | ... |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 279 | |
| 280 | // the following should be put just before calling Simulator::Run in the scenario |
| 281 | |
| 282 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::AppDelayTracer> > > |
| 283 | tracers = ndn::AppDelayTracer::InstallAll ("app-delays-trace.txt"); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 284 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 285 | Simulator::Run (); |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 286 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 287 | ... |
| 288 | |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 289 | 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: |
| 290 | |
| 291 | +-----------------+---------------------------------------------------------------------+ |
| 292 | | Column | Description | |
| 293 | +=================+=====================================================================+ |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 294 | | ``Time`` | simulation time when SeqNo was receivied | |
| 295 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 296 | | ``Node`` | node id, global unique | |
| 297 | +-----------------+---------------------------------------------------------------------+ |
| 298 | | ``AppId`` | app id, local unique on the node, not global | |
| 299 | +-----------------+---------------------------------------------------------------------+ |
| 300 | | ``SeqNo`` | seq number of the Interest-Data | |
| 301 | +-----------------+---------------------------------------------------------------------+ |
| 302 | | ``Type`` | Type of delay: | |
| 303 | | | | |
| 304 | | | - ``LastDelay`` means that ``DelayS`` and ``DelayUS`` represent | |
| 305 | | | delay between last Interest sent and Data packet received | |
| 306 | | | - ``FullDelay`` means that ``DelayS`` and ``DelayUS`` represent | |
| 307 | | | delay between first Interest sent and Data packet received | |
| 308 | | | (i.e., includes time of Interest retransmissions) | |
| 309 | +-----------------+---------------------------------------------------------------------+ |
| 310 | | ``DelayS`` | delay value, specified in seconds | |
| 311 | +-----------------+---------------------------------------------------------------------+ |
| 312 | | ``DelayUS`` | delay value, specified in microseconds (10^-6) | |
| 313 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 400aae1 | 2013-01-19 13:27:52 -0800 | [diff] [blame] | 314 | | ``RetxCount`` | number of Interest retransmissions (for LastDelay always equal to 1)| |
| 315 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 316 | | ``HopCount`` | combined number of number of hops for Interest and Data packet. | |
| 317 | | | Note that HopCount is increased anytime somebody calls Send method | |
| 318 | | | on a face, including delivery of Interest/Data to application via | |
| 319 | | | an AppFace (but not from application to ndn::L3Protocol!). | |
| 320 | | | | |
| 321 | | | One consequence is that Interests satisfied by an app will have | |
| 322 | | | even hop count (min hop count = 2), and Interests satisfied from | |
| 323 | | | caches will have off hop count (min hop count = 1) | |
| 324 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 29dfb98 | 2013-01-18 20:04:15 -0800 | [diff] [blame] | 325 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 326 | .. _app delay trace helper example: |
| 327 | |
| 328 | Example of application-level trace helper |
| 329 | +++++++++++++++++++++++++++++++++++++++++ |
| 330 | |
| 331 | This example (``ndn-tree-app-delay-tracer.cc``) demonstrates basic usage of application-level Interest-Data delay tracer. |
| 332 | |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 333 | 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] | 334 | |
| 335 | Example simulation (``ndn-tree-app-delay-tracer.cc``) scenario that utilizes trace helpers: |
| 336 | |
| 337 | .. literalinclude:: ../../examples/ndn-tree-app-delay-tracer.cc |
| 338 | :language: c++ |
| 339 | :linenos: |
| 340 | :lines: 21-31,64- |
| 341 | :emphasize-lines: 7-8,61-62 |
| 342 | |
| 343 | |
| 344 | To run this scenario, use the following command:: |
| 345 | |
| 346 | ./waf --run=ndn-tree-app-delay-tracer |
| 347 | |
| 348 | 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. |
| 349 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 350 | |
Alexander Afanasyev | b5e77d8 | 2013-04-10 15:55:26 -0700 | [diff] [blame] | 351 | Other types of stats |
| 352 | -------------------- |
| 353 | |
| 354 | .. _periodic tracing of Pending Interest Table (PIT) size: |
| 355 | |
| 356 | Periodic tracing of Pending Interest Table (PIT) size |
| 357 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 358 | |
| 359 | This example (``ndn-simple-with-pit-count-stats.cc``) shows how you can periodically print out current size of PIT on the selected nodes. |
| 360 | |
| 361 | .. literalinclude:: ../../examples/ndn-simple-with-pit-count-stats.cc |
| 362 | :language: c++ |
| 363 | :linenos: |
| 364 | :lines: 20-26,47- |
| 365 | :emphasize-lines: 9-20,43-46,61-63 |
| 366 | |
| 367 | To run this scenario, use the following command:: |
| 368 | |
| 369 | ./waf --run=ndn-simple-with-pit-count-stats |
| 370 | |