Thunderbots Project
Loading...
Searching...
No Matches
proto_tracker.h
1#include <queue>
2#include <string>
3
4#include "software/logger/logger.h"
5
7{
8 public:
14 ProtoTracker(const std::string& type);
15
21 void send(uint64_t seq_num);
22
26 bool isLastValid();
27
31 float getLossRate();
32
33 private:
40 float calculate_proto_loss_rate(uint64_t seq_num);
41
42 // Constants
43 static constexpr uint8_t RECENT_PROTO_LOSS_PERIOD = 100;
44
45 // Variables
46 std::string proto_type;
47 bool last_valid = false;
48 float proto_loss_rate = 0;
49
50 // Queue of the sequence numbers of received protos in the past
51 // RECENT_PROTO_LOSS_PERIOD protos
52 std::queue<uint64_t> recent_proto_seq_nums;
53};
Definition proto_tracker.h:7
float getLossRate()
Definition proto_tracker.cpp:40
void send(uint64_t seq_num)
Definition proto_tracker.cpp:5
bool isLastValid()
Definition proto_tracker.cpp:35