* Only append ACKs to outgoing packets if one or more ACKs are successfully dequeued

* Commented out noisy CAPS debugging messages
* Added a test (under packet tests for lack of a better place) to measure Environment.TickCount resolution and fail if the resolution is not consistently under a 10ms variance

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2813 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2009-05-27 00:29:43 +00:00
parent b49d0736cc
commit baaf1fb1f4
4 changed files with 40 additions and 13 deletions

View File

@@ -155,5 +155,31 @@ namespace OpenMetaverse.Tests
Assert.IsTrue(queryRepliesCount == bigPacket.QueryData.Length);
Assert.IsTrue(statusDataCount == bigPacket.StatusData.Length);
}
[Test]
public void TickCountResolution()
{
float minResolution = Single.MaxValue;
float maxResolution = Single.MinValue;
// Measure the resolution of Environment.TickCount
float tickCountResolution = 0f;
for (int i = 0; i < 10; i++)
{
int start = Environment.TickCount;
int now = start;
while (now == start)
now = Environment.TickCount;
float resolution = (float)(now - start);
tickCountResolution += tickCountResolution * 0.1f;
minResolution = Math.Min(minResolution, resolution);
maxResolution = Math.Max(maxResolution, resolution);
}
Console.WriteLine("Average Environment.TickCount resolution: " + tickCountResolution + "ms");
Assert.Less(maxResolution - minResolution, 10f, "Environment.TickCount resolution fluctuated between " +
minResolution + "ms and " + maxResolution + "ms");
}
}
}