diff options
author | Justin Clark-Casey (justincc) | 2014-09-30 18:12:51 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-10-02 22:30:44 +0100 |
commit | 05508b5c5610c5f56233d26aba46ee361fcab667 (patch) | |
tree | 852dda9602b6902c18ae1974320df87867cb7b50 /OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |
parent | Don't unnecessarily remove from backup objects that were not directly attache... (diff) | |
download | opensim-SC_OLD-05508b5c5610c5f56233d26aba46ee361fcab667.zip opensim-SC_OLD-05508b5c5610c5f56233d26aba46ee361fcab667.tar.gz opensim-SC_OLD-05508b5c5610c5f56233d26aba46ee361fcab667.tar.bz2 opensim-SC_OLD-05508b5c5610c5f56233d26aba46ee361fcab667.tar.xz |
Add "debug lludp throttle log <level> <avatar-first-name> <avatar-last-name>" to control extra throttle related debug logging.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 0d4f549..658d9bb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
@@ -43,8 +43,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | private static Int32 m_counter = 0; | 45 | private static Int32 m_counter = 0; |
46 | 46 | ||
47 | // private Int32 m_identifier; | 47 | private LLUDPClient m_client; |
48 | |||
49 | public string Identifier { get; private set; } | ||
50 | |||
51 | public int DebugLevel { get; set; } | ||
48 | 52 | ||
49 | /// <summary> | 53 | /// <summary> |
50 | /// Number of ticks (ms) per quantum, drip rate and max burst | 54 | /// Number of ticks (ms) per quantum, drip rate and max burst |
@@ -165,16 +169,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
165 | /// <summary> | 169 | /// <summary> |
166 | /// Default constructor | 170 | /// Default constructor |
167 | /// </summary> | 171 | /// </summary> |
172 | /// <param name="identifier">Identifier for this token bucket</param> | ||
168 | /// <param name="parent">Parent bucket if this is a child bucket, or | 173 | /// <param name="parent">Parent bucket if this is a child bucket, or |
169 | /// null if this is a root bucket</param> | 174 | /// null if this is a root bucket</param> |
170 | /// <param name="maxBurst">Maximum size of the bucket in bytes, or | ||
171 | /// zero if this bucket has no maximum capacity</param> | ||
172 | /// <param name="dripRate">Rate that the bucket fills, in bytes per | 175 | /// <param name="dripRate">Rate that the bucket fills, in bytes per |
173 | /// second. If zero, the bucket always remains full</param> | 176 | /// second. If zero, the bucket always remains full</param> |
174 | public TokenBucket(TokenBucket parent, Int64 dripRate) | 177 | public TokenBucket(string identifier, TokenBucket parent, Int64 dripRate) |
175 | { | 178 | { |
176 | // m_identifier = m_counter++; | 179 | Identifier = identifier; |
177 | m_counter++; | ||
178 | 180 | ||
179 | Parent = parent; | 181 | Parent = parent; |
180 | RequestedDripRate = dripRate; | 182 | RequestedDripRate = dripRate; |
@@ -301,7 +303,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
301 | // with no drip rate... | 303 | // with no drip rate... |
302 | if (DripRate == 0) | 304 | if (DripRate == 0) |
303 | { | 305 | { |
304 | m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0"); | 306 | m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", Identifier); |
305 | return; | 307 | return; |
306 | } | 308 | } |
307 | 309 | ||
@@ -321,7 +323,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
321 | 323 | ||
322 | public class AdaptiveTokenBucket : TokenBucket | 324 | public class AdaptiveTokenBucket : TokenBucket |
323 | { | 325 | { |
324 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 326 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
325 | 327 | ||
326 | /// <summary> | 328 | /// <summary> |
327 | /// The minimum rate for flow control. Minimum drip rate is one | 329 | /// The minimum rate for flow control. Minimum drip rate is one |
@@ -360,13 +362,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
360 | // <summary> | 362 | // <summary> |
361 | // | 363 | // |
362 | // </summary> | 364 | // </summary> |
363 | public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate) | 365 | public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 maxDripRate, bool enabled) |
366 | : base(identifier, parent, maxDripRate) | ||
364 | { | 367 | { |
365 | Enabled = enabled; | 368 | Enabled = enabled; |
366 | 369 | ||
367 | if (Enabled) | 370 | if (Enabled) |
368 | { | 371 | { |
369 | // m_log.DebugFormat("[TOKENBUCKET] Adaptive throttle enabled"); | 372 | // m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled"); |
370 | MaxDripRate = maxDripRate; | 373 | MaxDripRate = maxDripRate; |
371 | AdjustedDripRate = m_minimumFlow; | 374 | AdjustedDripRate = m_minimumFlow; |
372 | } | 375 | } |
@@ -377,9 +380,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
377 | // </summary> | 380 | // </summary> |
378 | public void ExpirePackets(Int32 count) | 381 | public void ExpirePackets(Int32 count) |
379 | { | 382 | { |
380 | // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); | ||
381 | if (Enabled) | 383 | if (Enabled) |
384 | { | ||
385 | if (DebugLevel > 0) | ||
386 | m_log.WarnFormat( | ||
387 | "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}", | ||
388 | AdjustedDripRate, count, Identifier); | ||
389 | |||
382 | AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); | 390 | AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); |
391 | } | ||
383 | } | 392 | } |
384 | 393 | ||
385 | // <summary> | 394 | // <summary> |