From af3498efdbd0b165a7e37095b1d8a9e54723993c Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 29 Jun 2014 18:49:27 +0300 Subject: [PATCH] In "show throttles", show the maximum drip rate. This shows whether a client is being throttled due to past poor performance. --- OpenSim/Framework/ClientInfo.cs | 1 + .../ClientStack/Linden/UDP/LLUDPClient.cs | 3 ++- .../ClientStack/Linden/UDP/TokenBucket.cs | 18 +++++++++--------- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 12 ++++++++---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs index 9021315084..d68078e88b 100644 --- a/OpenSim/Framework/ClientInfo.cs +++ b/OpenSim/Framework/ClientInfo.cs @@ -54,6 +54,7 @@ namespace OpenSim.Framework public int assetThrottle; public int textureThrottle; public int totalThrottle; + public int maxThrottle; public Dictionary SyncRequests = new Dictionary(); public Dictionary AsyncRequests = new Dictionary(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 51433cbbc3..39c9cb1de7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Create a token bucket throttle for this client that has the scene token bucket as a parent m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); - // Create a token bucket throttle for the total categary with the client bucket as a throttle + // Create a token bucket throttle for the total category with the client bucket as a throttle m_throttleCategory = new TokenBucket(m_throttleClient, 0); // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; @@ -262,6 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; m_info.totalThrottle = (int)m_throttleCategory.DripRate; + m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; return m_info; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 4c33db55c2..0d4f54951e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -335,13 +335,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // greater than this. // protected Int64 m_maxDripRate = 0; - protected Int64 MaxDripRate + public Int64 MaxDripRate { get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } - set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } + protected set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } } - - private bool m_enabled = false; + + public bool Enabled { get; private set; } // // @@ -362,9 +362,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate) { - m_enabled = enabled; + Enabled = enabled; - if (m_enabled) + if (Enabled) { // m_log.DebugFormat("[TOKENBUCKET] Adaptive throttle enabled"); MaxDripRate = maxDripRate; @@ -378,7 +378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ExpirePackets(Int32 count) { // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); - if (m_enabled) + if (Enabled) AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); } @@ -387,7 +387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // public void AcknowledgePackets(Int32 count) { - if (m_enabled) + if (Enabled) AdjustedDripRate = AdjustedDripRate + count; } } diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 2637b00e1e..6e8a1bfcd0 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -487,7 +487,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); report.AppendFormat( - "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n", + "{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}\n", + "Max", "Total", "Resend", "Land", @@ -499,7 +500,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); report.AppendFormat( - "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", + "{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}\n", + "kb/s", "kb/s", "kb/s", "kb/s", @@ -548,7 +550,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); report.AppendFormat( - "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", + "{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}", + (ci.maxThrottle * 8) / 1000, (ci.totalThrottle * 8) / 1000, (ci.resendThrottle * 8) / 1000, (ci.landThrottle * 8) / 1000, @@ -584,7 +587,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden ThrottleRates throttleRates = udpServer.ThrottleRates; report.AppendFormat( - "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", + "{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}", + "-", (throttleRates.Total * 8) / 1000, (throttleRates.Resend * 8) / 1000, (throttleRates.Land * 8) / 1000,