* 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:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user