diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llmessage/llpacketring.cpp | 6 | ||||
| -rw-r--r-- | indra/llmessage/llpacketring.h | 1 | ||||
| -rw-r--r-- | indra/llmessage/message.h | 4 | ||||
| -rw-r--r-- | indra/newview/llappviewer.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llviewerthrottle.cpp | 14 | ||||
| -rw-r--r-- | indra/newview/llviewerthrottle.h | 3 | 
6 files changed, 23 insertions, 6 deletions
| diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp index da3c502e9d..eb6650c6c5 100644 --- a/indra/llmessage/llpacketring.cpp +++ b/indra/llmessage/llpacketring.cpp @@ -344,6 +344,12 @@ bool LLPacketRing::expandRing()      return true;  } +F32 LLPacketRing::getBufferLoadRate() const +{ +    // goes up to MAX_BUFFER_RING_SIZE +    return (F32)mNumBufferedPackets / (F32)DEFAULT_BUFFER_RING_SIZE; +} +  void LLPacketRing::dumpPacketRingStats()  {      mNumDroppedPacketsTotal += mNumDroppedPackets; diff --git a/indra/llmessage/llpacketring.h b/indra/llmessage/llpacketring.h index 237efc12e0..572dcbd271 100644 --- a/indra/llmessage/llpacketring.h +++ b/indra/llmessage/llpacketring.h @@ -64,6 +64,7 @@ public:      S32 getNumBufferedBytes() const { return mNumBufferedBytes; }      S32 getNumDroppedPackets() const { return mNumDroppedPacketsTotal + mNumDroppedPackets; } +    F32 getBufferLoadRate() const; // from 0 to 4 (0 - empty, 1 - default size is full)      void dumpPacketRingStats();  protected:      // returns 'true' if we should intentionally drop a packet diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 1844d5e7cd..30945cac51 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -538,7 +538,6 @@ public:      //void  buildMessage(); -    S32     zeroCode(U8 **data, S32 *data_size);      S32     zeroCodeExpand(U8 **data, S32 *data_size);      S32     zeroCodeAdjustCurrentSendTotal(); @@ -755,6 +754,7 @@ public:      S32     getReceiveBytes() const;      S32     getUnackedListSize() const          { return mUnackedListSize; } +    F32     getBufferLoadRate() const           { return mPacketRing.getBufferLoadRate(); }      //const char* getCurrentSMessageName() const { return mCurrentSMessageName; }      //const char* getCurrentSBlockName() const { return mCurrentSBlockName; } @@ -842,12 +842,10 @@ private:      LLUUID mSessionID;      void    addTemplate(LLMessageTemplate *templatep); -    bool        decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template );      void        logMsgFromInvalidCircuit( const LLHost& sender, bool recv_reliable );      void        logTrustedMsgFromUntrustedCircuit( const LLHost& sender );      void        logValidMsg(LLCircuitData *cdp, const LLHost& sender, bool recv_reliable, bool recv_resent, bool recv_acks ); -    void        logRanOffEndOfPacket( const LLHost& sender );      class LLMessageCountInfo      { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a05c2376a0..4cf651de33 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5443,6 +5443,7 @@ void LLAppViewer::idleNetwork()      // Retransmit unacknowledged packets.      gXferManager->retransmitUnackedPackets();      gAssetStorage->checkForTimeouts(); +    gViewerThrottle.setBufferLoadRate(gMessageSystem->getBufferLoadRate());      gViewerThrottle.updateDynamicThrottle();      // Check that the circuit between the viewer and the agent's current diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index b0a00c29a4..8d935e4243 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -48,6 +48,8 @@ const F32 MIN_FRACTIONAL = 0.2f;  const F32 MIN_BANDWIDTH = 50.f;  const F32 MAX_BANDWIDTH = 6000.f;  const F32 STEP_FRACTIONAL = 0.1f; +const F32 HIGH_BUFFER_LOAD_TRESHOLD = 1.f; +const F32 LOW_BUFFER_LOAD_TRESHOLD = 0.8f;  const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD(3.0f); // packet loss % per s  const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD(0.5f); // packet loss % per s  const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds @@ -146,7 +148,7 @@ LLViewerThrottleGroup LLViewerThrottleGroup::operator-(const LLViewerThrottleGro  void LLViewerThrottleGroup::sendToSim() const  { -    LL_INFOS() << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL; +    LL_DEBUGS("Throttle") << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL;      LLMessageSystem* msg = gMessageSystem;      msg->newMessageFast(_PREHASH_AgentThrottle); @@ -305,7 +307,10 @@ void LLViewerThrottle::updateDynamicThrottle()      mUpdateTimer.reset();      LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT); -    if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD) +    if ( +        mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD // already losing packets +        || mBufferLoadRate >= HIGH_BUFFER_LOAD_TRESHOLD // let viewer sort through the backlog before it starts dropping packets +        )      {          if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH)          { @@ -318,7 +323,8 @@ void LLViewerThrottle::updateDynamicThrottle()          mCurrent.sendToSim();          LL_INFOS() << "Tightening network throttle to " << mCurrentBandwidth << LL_ENDL;      } -    else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD) +    else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD +             && mBufferLoadRate < LOW_BUFFER_LOAD_TRESHOLD)      {          if (mThrottleFrac >= MAX_FRACTIONAL || mCurrentBandwidth / 1024.0f >= MAX_BANDWIDTH)          { @@ -331,4 +337,6 @@ void LLViewerThrottle::updateDynamicThrottle()          mCurrent.sendToSim();          LL_INFOS() << "Easing network throttle to " << mCurrentBandwidth << LL_ENDL;      } + +    mBufferLoadRate = 0;  } diff --git a/indra/newview/llviewerthrottle.h b/indra/newview/llviewerthrottle.h index 28a24d04fc..9973c88549 100644 --- a/indra/newview/llviewerthrottle.h +++ b/indra/newview/llviewerthrottle.h @@ -70,12 +70,15 @@ public:      void updateDynamicThrottle();      void resetDynamicThrottle(); +    void setBufferLoadRate(F32 rate) { mBufferLoadRate = llmax(mBufferLoadRate, rate); } +      LLViewerThrottleGroup getThrottleGroup(const F32 bandwidth_kbps);      static const std::string sNames[TC_EOF];  protected:      F32 mMaxBandwidth;      F32 mCurrentBandwidth; +    F32 mBufferLoadRate = 0;      LLViewerThrottleGroup mCurrent; | 
