NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-l3-rate-tracer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef CCNX_RATE_L3_TRACER_H
21 #define CCNX_RATE_L3_TRACER_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 
25 #include "ndn-l3-tracer.hpp"
26 
27 #include "ns3/nstime.h"
28 #include "ns3/event-id.h"
29 #include "ns3/node-container.h"
30 
31 #include <tuple>
32 #include <map>
33 #include <list>
34 
35 namespace ns3 {
36 namespace ndn {
37 
42 class L3RateTracer : public L3Tracer {
43 public:
52  static void
53  InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
54 
63  static void
64  Install(const NodeContainer& nodes, const std::string& file, Time averagingPeriod = Seconds(0.5));
65 
74  static void
75  Install(Ptr<Node> node, const std::string& file, Time averagingPeriod = Seconds(0.5));
76 
83  static void
84  Destroy();
85 
91  L3RateTracer(shared_ptr<std::ostream> os, Ptr<Node> node);
92 
98  L3RateTracer(shared_ptr<std::ostream> os, const std::string& node);
99 
103  virtual ~L3RateTracer();
104 
117  static Ptr<L3RateTracer>
118  Install(Ptr<Node> node, shared_ptr<std::ostream> outputStream,
119  Time averagingPeriod = Seconds(0.5));
120 
121  // from L3Tracer
122  virtual void
123  PrintHeader(std::ostream& os) const;
124 
125  virtual void
126  Print(std::ostream& os) const;
127 
128 protected:
129  // from L3Tracer
130  virtual void
131  OutInterests(const Interest& interest, const Face& face);
132 
133  virtual void
134  InInterests(const Interest& interest, const Face& face);
135 
136  virtual void
137  OutData(const Data& data, const Face& face);
138 
139  virtual void
140  InData(const Data& data, const Face& face);
141 
142  virtual void
143  SatisfiedInterests(const nfd::pit::Entry&, const Face&, const Data&);
144 
145  virtual void
147 
148 private:
149  void
150  SetAveragingPeriod(const Time& period);
151 
152  void
153  PeriodicPrinter();
154 
155  void
156  Reset();
157 
158 private:
159  shared_ptr<std::ostream> m_os;
160  Time m_period;
161  EventId m_printEvent;
162 
163  mutable std::map<shared_ptr<const Face>, std::tuple<Stats, Stats, Stats, Stats>> m_stats;
164 };
165 
166 } // namespace ndn
167 } // namespace ns3
168 
169 #endif // CCNX_RATE_L3_TRACER_H
virtual ~L3RateTracer()
Destructor.
Copyright (c) 2011-2015 Regents of the University of California.
static void Destroy()
Explicit request to remove all statically created tracers.
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)
NDN network-layer rate tracer.
Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack...
Opaque type (shared_ptr) representing ID of a scheduled event.
represents a PIT entry
Definition: pit-entry.hpp:69
Copyright (c) 2011-2015 Regents of the University of California.
static void Install(const NodeContainer &nodes, const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on the selected simulation nodes.
virtual void Print(std::ostream &os) const
Print current trace data.
virtual void InInterests(const Interest &interest, const Face &face)
virtual void OutData(const Data &data, const Face &face)
virtual void TimedOutInterests(const nfd::pit::Entry &)
L3RateTracer(shared_ptr< std::ostream > os, Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
static void InstallAll(const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on all simulation nodes.
virtual void PrintHeader(std::ostream &os) const
Print head of the trace (e.g., for post-processing)
virtual void OutInterests(const Interest &interest, const Face &face)
virtual void InData(const Data &data, const Face &face)