NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
l2-rate-tracer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef L2_RATE_TRACER_H
21 #define L2_RATE_TRACER_H
22 
23 #include "l2-tracer.hpp"
24 
25 #include "ns3/nstime.h"
26 #include "ns3/event-id.h"
27 
28 #include <tuple>
29 #include <map>
30 
31 namespace ns3 {
32 
39 class L2RateTracer : public L2Tracer {
40 public:
44  L2RateTracer(std::shared_ptr<std::ostream> os, Ptr<Node> node);
45  virtual ~L2RateTracer();
46 
60  static void
61  InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
62 
69  static void
70  Destroy();
71 
72  void
73  SetAveragingPeriod(const Time& period);
74 
75  virtual void
76  PrintHeader(std::ostream& os) const;
77 
78  virtual void
79  Print(std::ostream& os) const;
80 
81  virtual void
82  Drop(Ptr<const Packet>);
83 
84 private:
85  void
86  PeriodicPrinter();
87 
88  void
89  Reset();
90 
91 private:
92  std::shared_ptr<std::ostream> m_os;
93  Time m_period;
94  EventId m_printEvent;
95 
96  mutable std::tuple<Stats, Stats, Stats, Stats> m_stats;
97 };
98 
99 } // namespace ns3
100 
101 #endif // L2_RATE_TRACER_H
l2-tracer.hpp
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::L2RateTracer::InstallAll
static void InstallAll(const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on all simulation nodes.
Definition: l2-rate-tracer.cpp:48
ns3::L2RateTracer::Destroy
static void Destroy()
Explicit request to remove all statically created tracers.
Definition: l2-rate-tracer.cpp:42
ns3::L2RateTracer::Print
virtual void Print(std::ostream &os) const
Definition: l2-rate-tracer.cpp:158
ns3::L2RateTracer::Drop
virtual void Drop(Ptr< const Packet >)
Definition: l2-rate-tracer.cpp:166
ns3::L2RateTracer::L2RateTracer
L2RateTracer(std::shared_ptr< std::ostream > os, Ptr< Node > node)
Network layer tracer constructor.
Definition: l2-rate-tracer.cpp:84
ns3::L2RateTracer::SetAveragingPeriod
void SetAveragingPeriod(const Time &period)
Definition: l2-rate-tracer.cpp:97
ns3::L2RateTracer::PrintHeader
virtual void PrintHeader(std::ostream &os) const
Definition: l2-rate-tracer.cpp:114
ns3::L2RateTracer::~L2RateTracer
virtual ~L2RateTracer()
Definition: l2-rate-tracer.cpp:91
ns3::L2RateTracer
Tracer to collect link-layer rate information about links.
Definition: l2-rate-tracer.hpp:39
ns3::L2Tracer
Link-layer tracer.
Definition: l2-tracer.hpp:39