From 9475a31f1bf2e8fd3a3f0b00bdb125d57092640c Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 13 Dec 2018 14:17:38 -0800 Subject: [PATCH] Record ACK data in stats --- libraries/networking/src/udt/Connection.cpp | 4 ++-- libraries/networking/src/udt/ConnectionStats.cpp | 10 ++++++++++ libraries/networking/src/udt/ConnectionStats.h | 5 ++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index 317c5e6255..2d5ac0218f 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -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()) { diff --git a/libraries/networking/src/udt/ConnectionStats.cpp b/libraries/networking/src/udt/ConnectionStats.cpp index 4f0722edd3..188cc3114d 100644 --- a/libraries/networking/src/udt/ConnectionStats.cpp +++ b/libraries/networking/src/udt/ConnectionStats.cpp @@ -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; diff --git a/libraries/networking/src/udt/ConnectionStats.h b/libraries/networking/src/udt/ConnectionStats.h index b7350d4341..8ff0ec90fd 100644 --- a/libraries/networking/src/udt/ConnectionStats.h +++ b/libraries/networking/src/udt/ConnectionStats.h @@ -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);