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 | |
| 16 | Tracing the aggregate number of Interests/Data packets forwarded by an NDN node |
| 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 | |
| 25 | ... |
| 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 | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 31 | |
| 32 | Simulator::Run (); |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 33 | |
| 34 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 35 | |
| 36 | |
| 37 | - :ndnsim:`ndn::L3RateTracer` |
| 38 | |
| 39 | Tracing the rate in bytes and in number of packets of Interest/Data packets forwarded by an NDN node |
| 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 | |
| 48 | ... |
| 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 | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 54 | |
| 55 | Simulator::Run (); |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 56 | |
| 57 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 58 | |
| 59 | |
| 60 | .. note:: |
| 61 | |
| 62 | A number of other tracers are available in ``plugins/tracers-broken`` folder, but they do not yet work with the current code. |
| 63 | 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. |
| 64 | |
| 65 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 66 | Example |
| 67 | +++++++ |
| 68 | |
| 69 | Please refer to the :ref:`this example <trace example>`. |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 70 | |
| 71 | .. _cs trace helper: |
| 72 | |
| 73 | Content store trace helper |
| 74 | -------------------------- |
| 75 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame^] | 76 | - :ndnsim:`ndn::CsTracer` |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 77 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame^] | 78 | 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] | 79 | |
| 80 | The following code enables content store tracing: |
| 81 | |
| 82 | .. code-block:: c++ |
| 83 | |
| 84 | // necessary includes |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame^] | 85 | #include <ns3/ndnSIM/utils/tracers/ndn-cs-tracer.h> |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 86 | |
| 87 | ... |
| 88 | |
| 89 | // Select implementation of content store. By default, the following is applied: |
| 90 | // ndnHelper.SetContentStore ("ns3::ndn::cs::Stats::Lru", "MaxSize", "100"); |
| 91 | |
| 92 | // the following should be put just before calling Simulator::Run in the scenario |
| 93 | |
Alexander Afanasyev | b1d6b03 | 2013-01-18 14:11:11 -0800 | [diff] [blame^] | 94 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::CsTracer> > > |
| 95 | aggTracers = ndn::CsTracer::InstallAll ("cs-trace.txt", Seconds (1)); |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 96 | |
| 97 | Simulator::Run (); |
| 98 | |
| 99 | ... |
| 100 | |
| 101 | .. - Tracing lifetime of content store entries |
| 102 | |
| 103 | .. Evaluate lifetime of the content store entries can be accomplished using modified version of the content stores. |
| 104 | .. In particular, |
| 105 | |
| 106 | |
| 107 | |
| 108 | Example |
| 109 | +++++++ |
| 110 | |
| 111 | :ref:`This example <cs trace helper example>` demonstrates one usage of content store tracer. |
| 112 | |