From 05508b5c5610c5f56233d26aba46ee361fcab667 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Sep 2014 18:12:51 +0100 Subject: Add "debug lludp throttle log " to control extra throttle related debug logging. --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 47 +++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9dc9e0d..d8ca343 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -82,6 +82,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Any level above 0 will turn on logging. public int DebugDataOutLevel { get; set; } + /// + /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. + /// + /// Any level above 0 will turn on logging. + public int ThrottleDebugLevel + { + get + { + return m_throttleDebugLevel; + } + + set + { + m_throttleDebugLevel = value; + m_throttleClient.DebugLevel = m_throttleDebugLevel; + m_throttleCategory.DebugLevel = m_throttleDebugLevel; + foreach (TokenBucket tb in m_throttleCategories) + tb.DebugLevel = m_throttleDebugLevel; + } + } + private int m_throttleDebugLevel; + /// Fired when updated networking stats are produced for this client public event PacketStats OnPacketStats; /// Fired when the queue for a packet category is empty. This event can be @@ -207,9 +229,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_maxRTO = maxRTO; // 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); + m_throttleClient + = new AdaptiveTokenBucket( + string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), + parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); + // Create a token bucket throttle for the total category with the client bucket as a throttle - m_throttleCategory = new TokenBucket(m_throttleClient, 0); + m_throttleCategory + = new TokenBucket( + string.Format("total throttle for {0} in {1}", AgentID, server.Scene.Name), + m_throttleClient, 0); + // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; @@ -221,8 +251,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize the packet outboxes, where packets sit while they are waiting for tokens m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + // Initialize the token buckets that control the throttling for each category - m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); + m_throttleCategories[i] + = new TokenBucket( + string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), + m_throttleCategory, rates.GetRate(type)); } // Default the retransmission timeout to one second @@ -371,8 +405,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP texture = (int)((1 - m_cannibalrate) * texture); //int total = resend + land + wind + cloud + task + texture + asset; - //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", - // AgentID, resend, land, wind, cloud, task, texture, asset, total); + + if (ThrottleDebugLevel > 0) + m_log.DebugFormat( + "[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}", + AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset); // Update the token buckets with new throttle values TokenBucket bucket; -- cgit v1.1