diff options
author | Mic Bowman | 2014-12-30 10:03:37 -0800 |
---|---|---|
committer | Mic Bowman | 2014-12-30 10:03:37 -0800 |
commit | 75df04f0b372625ed753b65bb84385fa258a58ea (patch) | |
tree | 7e4343c8fe480d61437977920c61ddc4f8cb1432 /OpenSim/Region/ClientStack | |
parent | Change the effect of successfully acknowledged packets to bump the (diff) | |
download | opensim-SC-75df04f0b372625ed753b65bb84385fa258a58ea.zip opensim-SC-75df04f0b372625ed753b65bb84385fa258a58ea.tar.gz opensim-SC-75df04f0b372625ed753b65bb84385fa258a58ea.tar.bz2 opensim-SC-75df04f0b372625ed753b65bb84385fa258a58ea.tar.xz |
Fix the throttle tests. Remove the hardcoded constant multipliers and
compute the expected values without depending on the token bucket code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 17e1af6..9241e37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |||
@@ -173,6 +173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
173 | IniConfigSource ics = new IniConfigSource(); | 173 | IniConfigSource ics = new IniConfigSource(); |
174 | IConfig config = ics.AddConfig("ClientStack.LindenUDP"); | 174 | IConfig config = ics.AddConfig("ClientStack.LindenUDP"); |
175 | config.Set("enable_adaptive_throttles", true); | 175 | config.Set("enable_adaptive_throttles", true); |
176 | config.Set("adaptive_throttle_min_bps", 32000); | ||
177 | |||
176 | TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); | 178 | TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); |
177 | 179 | ||
178 | ScenePresence sp | 180 | ScenePresence sp |
@@ -197,28 +199,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
197 | SetThrottles( | 199 | SetThrottles( |
198 | udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); | 200 | udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); |
199 | 201 | ||
200 | // Ratio of current adaptive drip rate to requested bytes | 202 | // Ratio of current adaptive drip rate to requested bytes, minimum rate is 32000 |
201 | // XXX: Should hard code this as below so we don't rely on values given by tested code to construct | 203 | double commitRatio = 32000.0 / totalBytes; |
202 | // expected values. | ||
203 | double commitRatio = (double)udpClient.FlowThrottle.AdjustedDripRate / udpClient.FlowThrottle.TargetDripRate; | ||
204 | 204 | ||
205 | AssertThrottles( | 205 | AssertThrottles( |
206 | udpClient, | 206 | udpClient, |
207 | LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, | 207 | LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, |
208 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); | 208 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); |
209 | 209 | ||
210 | // Test an increase in target throttle | 210 | // Test an increase in target throttle, ack of 20 packets adds 20 * LLUDPServer.MTU bytes |
211 | udpClient.FlowThrottle.AcknowledgePackets(25); | 211 | // to the throttle, recompute commitratio from those numbers |
212 | commitRatio = 0.2; | 212 | udpClient.FlowThrottle.AcknowledgePackets(20); |
213 | commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes; | ||
213 | 214 | ||
214 | AssertThrottles( | 215 | AssertThrottles( |
215 | udpClient, | 216 | udpClient, |
216 | resendBytes * commitRatio, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, | 217 | resendBytes * commitRatio, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, |
217 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); | 218 | textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); |
218 | 219 | ||
219 | // Test a decrease in target throttle | 220 | // Test a decrease in target throttle, adaptive throttle should cut the rate by 50% with a floor |
221 | // set by the minimum adaptive rate | ||
220 | udpClient.FlowThrottle.ExpirePackets(1); | 222 | udpClient.FlowThrottle.ExpirePackets(1); |
221 | commitRatio = 0.1; | 223 | commitRatio = Math.Max((32000.0 + 20.0 * LLUDPServer.MTU)/Math.Pow(2,1), 32000.0) / totalBytes; |
222 | 224 | ||
223 | AssertThrottles( | 225 | AssertThrottles( |
224 | udpClient, | 226 | udpClient, |