#3644 Fix new logging of packet drops hitting performance

master
Andrey Kleshchev 2025-03-04 19:55:55 +02:00 committed by Andrey Kleshchev
parent c98002daa6
commit 3efe5b4934
9 changed files with 30 additions and 1 deletions

View File

@ -304,7 +304,7 @@ S32 LLPacketRing::drainSocket(S32 socket)
S32 num_dropped_packets = (num_loops - 1 + old_num_packets) - mNumBufferedPackets;
if (num_dropped_packets > 0)
{
LL_WARNS("Messaging") << "dropped " << num_dropped_packets << " UDP packets" << LL_ENDL;
mNumDroppedPackets += num_dropped_packets;
}
return (S32)(mNumBufferedPackets);
}
@ -341,3 +341,17 @@ bool LLPacketRing::expandRing()
mHeadIndex = mNumBufferedPackets;
return true;
}
void LLPacketRing::dumpPacketRingStats()
{
mNumDroppedPacketsTotal += mNumDroppedPackets;
LL_INFOS("Messaging") << "Packet ring stats: " << std::endl
<< "Buffered packets: " << mNumBufferedPackets << std::endl
<< "Buffered bytes: " << mNumBufferedBytes << std::endl
<< "Dropped packets current: " << mNumDroppedPackets << std::endl
<< "Dropped packets total: " << mNumDroppedPacketsTotal << std::endl
<< "Dropped packets percentage: " << mDropPercentage << "%" << std::endl
<< "Actual in bytes: " << mActualBytesIn << std::endl
<< "Actual out bytes: " << mActualBytesOut << LL_ENDL;
mNumDroppedPackets = 0;
}

View File

@ -62,6 +62,9 @@ public:
S32 getNumBufferedPackets() const { return (S32)(mNumBufferedPackets); }
S32 getNumBufferedBytes() const { return mNumBufferedBytes; }
S32 getNumDroppedPackets() const { return mNumDroppedPacketsTotal + mNumDroppedPackets; }
void dumpPacketRingStats();
protected:
// returns 'true' if we should intentionally drop a packet
bool computeDrop();
@ -80,6 +83,8 @@ protected:
std::vector<LLPacketBuffer*> mPacketRing;
S16 mHeadIndex { 0 };
S16 mNumBufferedPackets { 0 };
S32 mNumDroppedPackets { 0 };
S32 mNumDroppedPacketsTotal { 0 };
S32 mNumBufferedBytes { 0 };
S32 mActualBytesIn { 0 };

View File

@ -724,6 +724,7 @@ bool LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count )
// Check to see if we need to print debug info
if ((mt_sec - mCircuitPrintTime) > mCircuitPrintFreq)
{
mPacketRing.dumpPacketRingStats();
dumpCircuitInfo();
mCircuitPrintTime = mt_sec;
}

View File

@ -3413,6 +3413,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["PACKETS_LOST"] = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST);
info["PACKETS_IN"] = packets_in;
info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal();
info["PACKETS_DROPPED"] = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_DROPPED);
}
if (mServerReleaseNotesURL.empty())

View File

@ -200,6 +200,7 @@ void LLFloaterLagMeter::determineNetwork()
// the network handlers are de-synched from the rendering.
F32Milliseconds client_frame_time = frame_recording.getPeriodMean(LLStatViewer::FRAME_STACKTIME);
// Todo: account for LLPacketRing dropped packets? viewer drops those when it can't keep up
if(packet_loss >= mNetworkPacketLossCritical)
{
mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));

View File

@ -121,6 +121,7 @@ LLTrace::CountStatHandle<> FPS("FPS", "Frames rendered"),
PACKETS_IN("Packets In", "Packets received"),
PACKETS_LOST("packetsloststat", "Packets lost"),
PACKETS_OUT("packetsoutstat", "Packets sent"),
PACKETS_DROPPED("packetsdropped", "Packets dropped"),
TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"),
CHAT_COUNT("chatcount", "Chat messages sent"),
IM_COUNT("imcount", "IMs sent"),
@ -647,6 +648,7 @@ void send_viewer_stats(bool include_preferences)
fail["send_packet"] = (S32) gMessageSystem->mSendPacketFailureCount;
fail["dropped"] = (S32) gMessageSystem->mDroppedPackets;
fail["ring_dropped"] = (S32)gMessageSystem->mPacketRing.getNumDroppedPackets();
fail["resent"] = (S32) gMessageSystem->mResentPackets;
fail["failed_resends"] = (S32) gMessageSystem->mFailedResendPackets;
fail["off_circuit"] = (S32) gMessageSystem->mOffCircuitPackets;

View File

@ -119,6 +119,7 @@ extern LLTrace::CountStatHandle<> FPS,
PACKETS_IN,
PACKETS_LOST,
PACKETS_OUT,
PACKETS_DROPPED,
TEXTURE_PACKETS,
CHAT_COUNT,
IM_COUNT,

View File

@ -304,6 +304,7 @@ void LLViewerThrottle::updateDynamicThrottle()
}
mUpdateTimer.reset();
// Todo: account for dropped packets from LLPacketRing (or make the thing threaded)
LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD)
{

View File

@ -795,6 +795,7 @@ void LLWorld::updateNetStats()
S32 packets_in = gMessageSystem->mPacketsIn - mLastPacketsIn;
S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut;
S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost;
S32 ring_packets_dropped = gMessageSystem->mPacketRing.getNumDroppedPackets();
F64Bits actual_in_bits(gMessageSystem->mPacketRing.getAndResetActualInBits());
F64Bits actual_out_bits(gMessageSystem->mPacketRing.getAndResetActualOutBits());
@ -805,6 +806,7 @@ void LLWorld::updateNetStats()
add(LLStatViewer::PACKETS_IN, packets_in);
add(LLStatViewer::PACKETS_OUT, packets_out);
add(LLStatViewer::PACKETS_LOST, packets_lost);
add(LLStatViewer::PACKETS_DROPPED, ring_packets_dropped);
F32 total_packets_in = (F32)LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
if (total_packets_in > 0.f)
@ -838,6 +840,7 @@ void LLWorld::printPacketsLost()
<< " packets lost: " << cdp->getPacketsLost() << LL_ENDL;
}
}
LL_INFOS() << "Packets dropped by Packet Ring: " << gMessageSystem->mPacketRing.getNumDroppedPackets() << LL_ENDL;
}
void LLWorld::processCoarseUpdate(LLMessageSystem* msg, void** user_data)