NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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
Link-layer tracer.
Definition: l2-tracer.hpp:39
Tracer to collect link-layer rate information about links.
static void InstallAll(const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on all simulation nodes.
Opaque type (shared_ptr) representing ID of a scheduled event.
virtual void PrintHeader(std::ostream &os) const
virtual void Print(std::ostream &os) const
Copyright (c) 2011-2015 Regents of the University of California.
static void Destroy()
Explicit request to remove all statically created tracers.
void SetAveragingPeriod(const Time &period)
virtual void Drop(Ptr< const Packet >)
L2RateTracer(std::shared_ptr< std::ostream > os, Ptr< Node > node)
Network layer tracer constructor.