RateAnalyzer.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_PPI_RateAnalyzer_
18 #define HH_SENF_PPI_RateAnalyzer_ 1
19 
20 // Custom includes
21 #include <boost/function.hpp>
22 #include <boost/signals2.hpp>
23 #include "MonitorModule.hh"
24 #include "IntervalTimer.hh"
25 
26 //#include "RateAnalyzer.mpp"
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 
29 namespace senf {
30 namespace ppi {
31 namespace module {
32 
60  : public MonitorModule<>
61  {
63  public:
64  //-////////////////////////////////////////////////////////////////////////
66  //\{
67 
68  RateAnalyzer();
69 
70  //\}
71  //-////////////////////////////////////////////////////////////////////////
72  // Statistics signals
73 
74  struct Statistics {
75  boost::signals2::signal<void (float)> packetsPerSecond;
76  boost::signals2::signal<void (float)> bytesPerSecond;
77  boost::signals2::signal<void (unsigned,float,unsigned)> bytesPerPacket;
78  } signals;
79 
82 
83  private:
84  void v_handlePacket(Packet const & p) override;
85  void tick();
86 
88  unsigned packets_;
89  unsigned bytes_;
90  unsigned minSize_;
91  unsigned maxSize_;
92  double factor_;
93  };
94 
95 }}}
96 
97 //-/////////////////////////////////////////////////////////////////////////////////////////////////
98 //#include "RateAnalyzer.cci"
99 //#include "RateAnalyzer.ct"
100 //#include "RateAnalyzer.cti"
101 #endif
102 
103 
104 // Local Variables:
105 // mode: c++
106 // fill-column: 100
107 // comment-column: 40
108 // c-file-style: "senf"
109 // indent-tabs-mode: nil
110 // ispell-local-dictionary: "american"
111 // compile-command: "scons -u test"
112 // End:
boost::signals2::signal< void(float)> packetsPerSecond
Definition: RateAnalyzer.hh:75
config::time_type clock_type
Generate periodic packet statistics.
Definition: RateAnalyzer.hh:59
High precision regularly signaled event.
void startStatistics(senf::ClockService::clock_type interval)
Start generating statistics at given interval.
Definition: RateAnalyzer.cc:32
Base class providing simple monitor module support.
MonitorModule public header.
#define SENF_PPI_MODULE(name)
Define PPI Module.
Definition: Module.hh:346
struct senf::ppi::module::RateAnalyzer::Statistics signals
boost::signals2::signal< void(unsigned, float, unsigned)> bytesPerPacket
Definition: RateAnalyzer.hh:77
IntervalTimer public header.
boost::signals2::signal< void(float)> bytesPerSecond
Definition: RateAnalyzer.hh:76