blob: 37e43812f1f936ea1ffb85eea4ee01813152c88d [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 Afanasyevf4a03592012-12-10 16:12:34 -08007It is also possible to use existing trace helpers, which collects and aggregates requested statistical information in text files.
8
Alexander Afanasyev59314802012-11-26 14:56:04 -08009.. _trace classes:
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080010
Alexander Afanasyevf4a03592012-12-10 16:12:34 -080011Packet-level trace helpers
12--------------------------
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080013
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 Afanasyev59314802012-11-26 14:56:04 -080022 // necessary includes
23 #include <ns3/ndnSIM/utils/tracers/ndn-l3-aggregate-tracer.h>
24
25 ...
26
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080027 // the following should be put just before calling Simulator::Run in the scenario
28
Alexander Afanasyev59314802012-11-26 14:56:04 -080029 boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3AggregateTracer> > >
30 aggTracers = ndn::L3AggregateTracer::InstallAll ("aggregate-trace.txt", Seconds (1.0));
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080031
32 Simulator::Run ();
Alexander Afanasyev59314802012-11-26 14:56:04 -080033
34 ...
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080035
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 Afanasyev59314802012-11-26 14:56:04 -080045 // necessary includes
46 #include <ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.h>
47
48 ...
49
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080050 // the following should be put just before calling Simulator::Run in the scenario
51
Alexander Afanasyev59314802012-11-26 14:56:04 -080052 boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::L3RateTracer> > >
53 rateTracers = ndn::L3RateTracer::InstallAll ("rate-trace.txt", Seconds (1.0));
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080054
55 Simulator::Run ();
Alexander Afanasyev59314802012-11-26 14:56:04 -080056
57 ...
Alexander Afanasyevb1314b12012-11-21 18:23:42 -080058
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 Afanasyev59314802012-11-26 14:56:04 -080066Example
67+++++++
68
69Please refer to the :ref:`this example <trace example>`.
Alexander Afanasyevf4a03592012-12-10 16:12:34 -080070
71.. _cs trace helper:
72
73Content store trace helper
74--------------------------
75
76- :ndnsim:`ndn::CsImpTracer`
77
78 With the use of :ndnsim:`ndn::CsImpTracer` it is possible to obtain statistics of cache hits/cache misses on simulation nodes.
79
80 The following code enables content store tracing:
81
82 .. code-block:: c++
83
84 // necessary includes
85 #include <ns3/ndnSIM/utils/tracers/ndn-cs-imp-tracer.h>
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
94 boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<ndn::CsImpTracer> > >
95 aggTracers = ndn::CsImpTracer::InstallAll ("cs-trace.txt", Seconds (1));
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
108Example
109+++++++
110
111:ref:`This example <cs trace helper example>` demonstrates one usage of content store tracer.
112