Record ACK data in stats

This commit is contained in:
Clement 2018-12-13 14:17:38 -08:00
parent f163bbc0d5
commit 9475a31f1b
3 changed files with 16 additions and 3 deletions

View file

@ -221,7 +221,7 @@ void Connection::sendACK() {
// have the socket send off our packet
_parentSocket->writeBasePacket(*_ackPacket, _destination);
_stats.record(ConnectionStats::Stats::SentACK);
_stats.recordSentACK(_ackPacket->getWireSize());
}
SequenceNumber Connection::nextACK() const {
@ -327,7 +327,7 @@ void Connection::processACK(ControlPacketPointer controlPacket) {
controlPacket->readPrimitive(&ack);
// update the total count of received ACKs
_stats.record(ConnectionStats::Stats::ReceivedACK);
_stats.recordReceivedACK(controlPacket->getWireSize());
// validate that this isn't a BS ACK
if (ack > getSendQueue().getCurrentSequenceNumber()) {

View file

@ -36,6 +36,16 @@ void ConnectionStats::record(Stats::Event event) {
++_currentSample.events[(int) event];
}
void ConnectionStats::recordSentACK(int size) {
record(Stats::SentACK);
recordSentPackets(0, size);
}
void ConnectionStats::recordReceivedACK(int size) {
record(Stats::ReceivedACK);
recordReceivedPackets(0, size);
}
void ConnectionStats::recordSentPackets(int payload, int total) {
++_currentSample.sentPackets;
_currentSample.sentUtilBytes += payload;

View file

@ -78,7 +78,10 @@ public:
Stats sample();
void record(Stats::Event event);
void recordSentACK(int size);
void recordReceivedACK(int size);
void recordSentPackets(int payload, int total);
void recordReceivedPackets(int payload, int total);