From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 75 ++++++++++++---------- 1 file changed, 40 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 3c82a78..873b1e5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -35,6 +35,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.ClientStack.LindenUDP.Tests { + /* [TestFixture] public class ThrottleTests : OpenSimTestCase { @@ -57,16 +58,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests [Test] public void TestSetRequestDripRate() { + TestHelpers.InMethod(); - TokenBucket tb = new TokenBucket("tb", null, 5000, 0); + TokenBucket tb = new TokenBucket(null, 5000f,10000f); AssertRates(tb, 5000, 0, 5000, 0); - tb.RequestedDripRate = 4000; + tb.RequestedDripRate = 4000f; AssertRates(tb, 4000, 0, 4000, 0); tb.RequestedDripRate = 6000; AssertRates(tb, 6000, 0, 6000, 0); + } [Test] @@ -74,7 +77,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { TestHelpers.InMethod(); - TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); + TokenBucket tb = new TokenBucket(null, 5000,15000); AssertRates(tb, 5000, 0, 5000, 10000); tb.RequestedDripRate = 4000; @@ -92,9 +95,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { TestHelpers.InMethod(); - TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); - TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); - TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); + TokenBucket tbParent = new TokenBucket("tbParent", null, 0); + TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000); + TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000); AssertRates(tbParent, 8000, 8000, 8000, 0); AssertRates(tbChild1, 3000, 0, 3000, 0); @@ -113,6 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests AssertRates(tbParent, 6000, 8000, 6000, 0); AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0); AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0); + } private void AssertRates( @@ -133,7 +137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests Scene scene = new SceneHelpers().SetupScene(); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -141,7 +145,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpServer.Throttle.DebugLevel = 1; udpClient.ThrottleDebugLevel = 1; - + int resendBytes = 1000; int landBytes = 2000; int windBytes = 3000; @@ -157,8 +161,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; AssertThrottles( - udpClient, - LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes, + udpClient, + LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes, totalBytes, 0, 0); } @@ -177,7 +181,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -203,7 +207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests double commitRatio = 32000.0 / totalBytes; AssertThrottles( - udpClient, + udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); @@ -213,7 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes; AssertThrottles( - udpClient, + udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); @@ -223,7 +227,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes; AssertThrottles( - udpClient, + udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); } @@ -244,14 +248,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests int taskBytes = 14000; int textureBytes = 16000; int assetBytes = 18000; - int totalBytes + int totalBytes = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); Scene scene = new SceneHelpers().SetupScene(); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); udpServer.Throttle.RequestedDripRate = totalBytes; - ScenePresence sp1 + ScenePresence sp1 = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -261,8 +265,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, + udpClient1, + resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, textureBytes / 2, assetBytes / 2, totalBytes, 0, 0); // Test: Now add another client @@ -277,13 +281,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, + udpClient1, + resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0); AssertThrottles( - udpClient2, - resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, + udpClient2, + resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0); } @@ -303,14 +307,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests int taskBytes = 12000; int textureBytes = 14000; int assetBytes = 16000; - int totalBytes + int totalBytes = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); Scene scene = new SceneHelpers().SetupScene(); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); udpServer.ThrottleRates.Total = totalBytes; - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -321,8 +325,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient, - resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, + udpClient, + resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes); } @@ -348,7 +352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpServer.ThrottleRates.Total = (int)(totalBytes * 1.1); udpServer.Throttle.RequestedDripRate = (int)(totalBytes * 1.5); - ScenePresence sp1 + ScenePresence sp1 = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -359,8 +363,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes, landBytes, windBytes, cloudBytes, taskBytes, + udpClient1, + resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1); // Now add another client @@ -375,25 +379,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, + udpClient1, + resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1); AssertThrottles( - udpClient2, - resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, + udpClient2, + resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1); } private void AssertThrottles( - LLUDPClient udpClient, + LLUDPClient udpClient, double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes, double totalBytes, double targetBytes, double maxBytes) { ClientInfo ci = udpClient.GetClientInfo(); // Console.WriteLine( -// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", +// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); @@ -424,4 +428,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient.SetThrottles(throttles); } } + */ } \ No newline at end of file -- cgit v1.1