Hardware/CPU/IntelCPU.cs
changeset 97 1a2d7dad320e
parent 91 c0937b698b81
child 100 25d18bbaa9cf
     1.1 --- a/Hardware/CPU/IntelCPU.cs	Sun Apr 25 13:16:28 2010 +0000
     1.2 +++ b/Hardware/CPU/IntelCPU.cs	Sun Apr 25 14:40:19 2010 +0000
     1.3 @@ -211,7 +211,11 @@
     1.4        EstimateMaxClock(0); 
     1.5  
     1.6        // estimate the max clock in MHz      
     1.7 -      estimatedMaxClock = 1e-6 * EstimateMaxClock(0.01);
     1.8 +      List<double> estimatedMaxClocks = new List<double>(3);
     1.9 +      for (int i = 0; i < 3; i++)
    1.10 +        estimatedMaxClocks.Add(1e-6 * EstimateMaxClock(0.025));
    1.11 +      estimatedMaxClocks.Sort();
    1.12 +      estimatedMaxClock = estimatedMaxClocks[1];
    1.13  
    1.14        lastTimeStampCount = 0;
    1.15        lastTime = 0;
    1.16 @@ -289,7 +293,8 @@
    1.17        uint lsbBegin, msbBegin, lsbEnd, msbEnd; 
    1.18        
    1.19        Thread.BeginThreadAffinity();
    1.20 -      long timeBegin = Stopwatch.GetTimestamp() + 2;
    1.21 +      long timeBegin = Stopwatch.GetTimestamp() + 
    1.22 +        (long)Math.Ceiling(0.001 * ticks);
    1.23        long timeEnd = timeBegin + ticks;      
    1.24        while (Stopwatch.GetTimestamp() < timeBegin) { }
    1.25        WinRing0.Rdtsc(out lsbBegin, out msbBegin);