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 | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 7 | .. _trace classes: |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 8 | |
| 9 | Tracer classes |
| 10 | -------------- |
| 11 | |
| 12 | ndnSIM provides a few helper tracers that simplify process of obtaining metrics. |
| 13 | |
| 14 | Currently, there are only 2 useful tracers: |
| 15 | |
| 16 | - :ndnsim:`ndn::L3AggregateTracer` |
| 17 | |
| 18 | Tracing the aggregate number of Interests/Data packets forwarded by an NDN node |
| 19 | |
| 20 | The following example enables tracing on all simulation nodes: |
| 21 | |
| 22 | .. code-block:: c++ |
| 23 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 24 | // necessary includes |
| 25 | #include <ns3/ndnSIM/utils/tracers/ndn-l3-aggregate-tracer.h> |
| 26 | |
| 27 | ... |
| 28 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 29 | // the following should be put just before calling Simulator::Run in the scenario |
| 30 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 31 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3AggregateTracer> > > |
| 32 | aggTracers = ndn::L3AggregateTracer::InstallAll ("aggregate-trace.txt", Seconds (1.0)); |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 33 | |
| 34 | Simulator::Run (); |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 35 | |
| 36 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 37 | |
| 38 | |
| 39 | - :ndnsim:`ndn::L3RateTracer` |
| 40 | |
| 41 | Tracing the rate in bytes and in number of packets of Interest/Data packets forwarded by an NDN node |
| 42 | |
| 43 | The following example enables tracing on all simulation nodes: |
| 44 | |
| 45 | .. code-block:: c++ |
| 46 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 47 | // necessary includes |
| 48 | #include <ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.h> |
| 49 | |
| 50 | ... |
| 51 | |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 52 | // the following should be put just before calling Simulator::Run in the scenario |
| 53 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 54 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3RateTracer> > > |
| 55 | rateTracers = ndn::L3RateTracer::InstallAll ("rate-trace.txt", Seconds (1.0)); |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 56 | |
| 57 | Simulator::Run (); |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 58 | |
| 59 | ... |
Alexander Afanasyev | b1314b1 | 2012-11-21 18:23:42 -0800 | [diff] [blame] | 60 | |
| 61 | |
| 62 | .. note:: |
| 63 | |
| 64 | A number of other tracers are available in ``plugins/tracers-broken`` folder, but they do not yet work with the current code. |
| 65 | 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. |
| 66 | |
| 67 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 68 | Example |
| 69 | +++++++ |
| 70 | |
| 71 | Please refer to the :ref:`this example <trace example>`. |