blob: aeff2362344733940c6338f572dbc7a657a365dc [file] [log] [blame]
Alexander Afanasyevb1314b12012-11-21 18:23:42 -08001
2Obtaining metrics
3=================
4
5To 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 Afanasyev59314802012-11-26 14:56:04 -08007.. _trace classes:
Alexander Afanasyevb1314b12012-11-21 18:23:42 -08008
9Tracer classes
10--------------
11
12ndnSIM provides a few helper tracers that simplify process of obtaining metrics.
13
14Currently, 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 Afanasyev59314802012-11-26 14:56:04 -080024 // necessary includes
25 #include <ns3/ndnSIM/utils/tracers/ndn-l3-aggregate-tracer.h>
26
27 ...
28
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080029 // the following should be put just before calling Simulator::Run in the scenario
30
Alexander Afanasyev59314802012-11-26 14:56:04 -080031 boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3AggregateTracer> > >
32 aggTracers = ndn::L3AggregateTracer::InstallAll ("aggregate-trace.txt", Seconds (1.0));
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080033
34 Simulator::Run ();
Alexander Afanasyev59314802012-11-26 14:56:04 -080035
36 ...
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080037
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 Afanasyev59314802012-11-26 14:56:04 -080047 // necessary includes
48 #include <ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.h>
49
50 ...
51
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080052 // the following should be put just before calling Simulator::Run in the scenario
53
Alexander Afanasyev59314802012-11-26 14:56:04 -080054 boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3RateTracer> > >
55 rateTracers = ndn::L3RateTracer::InstallAll ("rate-trace.txt", Seconds (1.0));
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080056
57 Simulator::Run ();
Alexander Afanasyev59314802012-11-26 14:56:04 -080058
59 ...
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080060
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 Afanasyev59314802012-11-26 14:56:04 -080068Example
69+++++++
70
71Please refer to the :ref:`this example <trace example>`.