add special packets and nack packets to outbound stats

This commit is contained in:
Brad Hefta-Gaub 2015-11-12 16:36:06 -08:00
parent da651ac475
commit 83e7eb58b9
4 changed files with 29 additions and 2 deletions

View file

@ -240,6 +240,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
auto nodeList = DependencyManager::get<NodeList>();
int packetsSent = 0;
int totalBytesSent = 0;
NodeToSenderStatsMapIterator i = _singleSenderStats.begin();
while (i != _singleSenderStats.end()) {
@ -291,12 +292,15 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
packetsSent += nackPacketList->getNumPackets();
// send the list of nack packets
nodeList->sendPacketList(std::move(nackPacketList), *destinationNode);
totalBytesSent += nodeList->sendPacketList(std::move(nackPacketList), *destinationNode);
}
++i;
}
OctreeSendThread::_totalPackets += packetsSent;
OctreeSendThread::_totalBytes += totalBytesSent;
return packetsSent;
}

View file

@ -118,6 +118,10 @@ AtomicUIntStat OctreeSendThread::_totalBytes { 0 };
AtomicUIntStat OctreeSendThread::_totalWastedBytes { 0 };
AtomicUIntStat OctreeSendThread::_totalPackets { 0 };
AtomicUIntStat OctreeSendThread::_totalSpecialBytes { 0 };
AtomicUIntStat OctreeSendThread::_totalSpecialPackets { 0 };
int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytesSent, int& truePacketsSent) {
OctreeServer::didHandlePacketSend(this);
@ -580,11 +584,17 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
// send the environment packet
// TODO: should we turn this into a while loop to better handle sending multiple special packets
if (_myServer->hasSpecialPacketsToSend(_node) && !nodeData->isShuttingDown()) {
int specialPacketsSent;
int specialPacketsSent = 0;
trueBytesSent += _myServer->sendSpecialPackets(_node, nodeData, specialPacketsSent);
nodeData->resetOctreePacket(); // because nodeData's _sequenceNumber has changed
truePacketsSent += specialPacketsSent;
packetsSentThisInterval += specialPacketsSent;
_totalPackets += specialPacketsSent;
_totalBytes += trueBytesSent;
_totalSpecialPackets += specialPacketsSent;
_totalSpecialBytes += trueBytesSent;
}
// Re-send packets that were nacked by the client

View file

@ -38,6 +38,9 @@ public:
static AtomicUIntStat _totalWastedBytes;
static AtomicUIntStat _totalPackets;
static AtomicUIntStat _totalSpecialBytes;
static AtomicUIntStat _totalSpecialPackets;
static AtomicUIntStat _usleepTime;
static AtomicUIntStat _usleepCalls;

View file

@ -415,6 +415,9 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
quint64 totalBytesOfBitMasks = OctreePacketData::getTotalBytesOfBitMasks();
quint64 totalBytesOfColor = OctreePacketData::getTotalBytesOfColor();
quint64 totalOutboundSpecialPackets = OctreeSendThread::_totalSpecialPackets;
quint64 totalOutboundSpecialBytes = OctreeSendThread::_totalSpecialBytes;
statsString += QString(" Total Clients Connected: %1 clients\r\n")
.arg(locale.toString((uint)getCurrentClientCount()).rightJustified(COLUMN_WIDTH, ' '));
@ -606,6 +609,13 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
.arg(locale.toString((uint)totalOutboundPackets).rightJustified(COLUMN_WIDTH, ' '));
statsString += QString(" Total Outbound Bytes: %1 bytes\r\n")
.arg(locale.toString((uint)totalOutboundBytes).rightJustified(COLUMN_WIDTH, ' '));
statsString += QString(" Total Outbound Special Packets: %1 packets\r\n")
.arg(locale.toString((uint)totalOutboundSpecialPackets).rightJustified(COLUMN_WIDTH, ' '));
statsString += QString(" Total Outbound Special Bytes: %1 bytes\r\n")
.arg(locale.toString((uint)totalOutboundSpecialBytes).rightJustified(COLUMN_WIDTH, ' '));
statsString += QString(" Total Wasted Bytes: %1 bytes\r\n")
.arg(locale.toString((uint)totalWastedBytes).rightJustified(COLUMN_WIDTH, ' '));
statsString += QString().sprintf(" Total OctalCode Bytes: %s bytes (%5.2f%%)\r\n",