MADARA  3.2.3
CounterFilter.inl
Go to the documentation of this file.
1 #ifndef _MADARA_FILTERS_COUNTER_FILTER_INL_
2 #define _MADARA_FILTERS_COUNTER_FILTER_INL_
3 
4 #include "CounterFilter.h"
5 
8 {
9  return packets_;
10 }
11 
14 {
16 
17  if (initialized_)
18  {
19  result = last_message_ - first_message_;
20  }
21 
22  return result;
23 }
24 
26 {
27  double result (0);
28 
29  if (initialized_)
30  {
31  // convert elapsed time into seconds
32  double elapsed = (double)(last_message_ - first_message_);
33  //elapsed *= 0.000000001;
34 
35  // divide packets by time elapsed in seconds
36  result = packets_ / elapsed;
37  }
38 
39  return result;
40 }
41 
42 #endif // _MADARA_FILTERS_COUNTER_FILTER_INL_
knowledge::KnowledgeRecord::Integer last_message_
The time of the last clear of the peer_list.
Definition: CounterFilter.h:97
knowledge::KnowledgeRecord::Integer first_message_
The time to keep record of a peer.
Definition: CounterFilter.h:92
double get_throughput()
Returns the throughput in terms of packets/second.
bool initialized_
Tracks if the first timer has been initialized.
Definition: CounterFilter.h:82
knowledge::KnowledgeRecord::Integer get_count()
Gets the number of packets filtered.
knowledge::KnowledgeRecord::Integer packets_
A map of discovered peers.
Definition: CounterFilter.h:87
knowledge::KnowledgeRecord::Integer get_elapsed()
Returns the duration of filtering from first to last message in nanoseconds.