diff options
author | Justin Clark-Casey (justincc) | 2014-10-28 00:44:03 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:22:20 +0000 |
commit | 5ab5d7fe476e39452fc80465ea2506b7b9f7773e (patch) | |
tree | 5e6e8a9f4f4fd49f66694fc9a7948690653cd4a9 /OpenSim/Region/ClientStack/Linden/UDP/Tests | |
parent | Fix setting of max scene throttle so that setting it restricts the child clie... (diff) | |
download | opensim-SC-5ab5d7fe476e39452fc80465ea2506b7b9f7773e.zip opensim-SC-5ab5d7fe476e39452fc80465ea2506b7b9f7773e.tar.gz opensim-SC-5ab5d7fe476e39452fc80465ea2506b7b9f7773e.tar.bz2 opensim-SC-5ab5d7fe476e39452fc80465ea2506b7b9f7773e.tar.xz |
Fix recent regression where adaptive throttles stopped adjusting.
Extends regression tests to test response of adaptive throttles to ack'ed and expired packets.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 912c994..0560b9b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |||
@@ -184,7 +184,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
184 | udpServer.Throttle.DebugLevel = 1; | 184 | udpServer.Throttle.DebugLevel = 1; |
185 | udpClient.ThrottleDebugLevel = 1; | 185 | udpClient.ThrottleDebugLevel = 1; |
186 | 186 | ||
187 | // Total is 28000 | 187 | // Total is 280000 |
188 | int resendBytes = 10000; | 188 | int resendBytes = 10000; |
189 | int landBytes = 20000; | 189 | int landBytes = 20000; |
190 | int windBytes = 30000; | 190 | int windBytes = 30000; |
@@ -192,24 +192,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
192 | int taskBytes = 50000; | 192 | int taskBytes = 50000; |
193 | int textureBytes = 60000; | 193 | int textureBytes = 60000; |
194 | int assetBytes = 70000; | 194 | int assetBytes = 70000; |
195 | int totalBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; | ||
195 | 196 | ||
196 | SetThrottles( | 197 | SetThrottles( |
197 | udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); | 198 | udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); |
198 | 199 | ||
199 | // We expect individual throttle changes to currently have no effect under adaptive, since this is managed | 200 | // Ratio of current adaptive drip rate to requested bytes |
200 | // purely by that throttle. However, we expect the max to change. | 201 | // XXX: Should hard code this as below so we don't rely on values given by tested code to construct |
201 | // XXX: At the moment we check against defaults, but at some point there should be a better test to | 202 | // expected values. |
202 | // active see change over time. | 203 | double commitRatio = (double)udpClient.FlowThrottle.AdjustedDripRate / udpClient.FlowThrottle.TargetDripRate; |
203 | ThrottleRates defaultRates = udpServer.ThrottleRates; | 204 | |
205 | AssertThrottles( | ||
206 | udpClient, | ||
207 | LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, | ||
208 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); | ||
209 | |||
210 | // Test an increase in target throttle | ||
211 | udpClient.FlowThrottle.AcknowledgePackets(35000); | ||
212 | commitRatio = 0.2; | ||
213 | |||
214 | AssertThrottles( | ||
215 | udpClient, | ||
216 | resendBytes * commitRatio, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, | ||
217 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); | ||
204 | 218 | ||
205 | // Current total is 66750 | 219 | // Test a decrease in target throttle |
206 | int totalBytes = defaultRates.Resend + defaultRates.Land + defaultRates.Wind + defaultRates.Cloud + defaultRates.Task + defaultRates.Texture + defaultRates.Asset; | 220 | udpClient.FlowThrottle.ExpirePackets(1); |
207 | int totalMaxBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; | 221 | commitRatio = 0.1; |
208 | 222 | ||
209 | AssertThrottles( | 223 | AssertThrottles( |
210 | udpClient, | 224 | udpClient, |
211 | defaultRates.Resend, defaultRates.Land, defaultRates.Wind, defaultRates.Cloud, defaultRates.Task, | 225 | LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, |
212 | defaultRates.Texture, defaultRates.Asset, totalBytes, totalMaxBytes, 0); | 226 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); |
213 | } | 227 | } |
214 | 228 | ||
215 | /// <summary> | 229 | /// <summary> |
@@ -376,9 +390,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
376 | { | 390 | { |
377 | ClientInfo ci = udpClient.GetClientInfo(); | 391 | ClientInfo ci = udpClient.GetClientInfo(); |
378 | 392 | ||
379 | // Console.WriteLine( | 393 | // Console.WriteLine( |
380 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", | 394 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", |
381 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); | 395 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); |
382 | 396 | ||
383 | Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); | 397 | Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); |
384 | Assert.AreEqual((int)landBytes, ci.landThrottle, "Land"); | 398 | Assert.AreEqual((int)landBytes, ci.landThrottle, "Land"); |