Fixed the initialization of the TSC estimating code.
authormoel.mich
Fri, 01 Oct 2010 19:01:09 +0000
changeset 203ca487ba88c24
parent 202 551243a66b32
child 204 59278dadc5c0
Fixed the initialization of the TSC estimating code.
Hardware/CPU/AMD10CPU.cs
Hardware/CPU/GenericCPU.cs
Properties/AssemblyVersion.cs
     1.1 --- a/Hardware/CPU/AMD10CPU.cs	Thu Sep 30 20:59:21 2010 +0000
     1.2 +++ b/Hardware/CPU/AMD10CPU.cs	Fri Oct 01 19:01:09 2010 +0000
     1.3 @@ -64,8 +64,6 @@
     1.4  
     1.5      private double timeStampCounterMultiplier;
     1.6  
     1.7 -    private StringBuilder debug = new StringBuilder();
     1.8 -
     1.9      public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
    1.10        : base(processorIndex, cpuid, settings) 
    1.11      {            
    1.12 @@ -180,9 +178,6 @@
    1.13          CultureInfo.InvariantCulture));
    1.14        r.AppendLine();
    1.15  
    1.16 -      r.Append(debug);
    1.17 -      r.AppendLine();
    1.18 -
    1.19        return r.ToString();
    1.20      }
    1.21  
     2.1 --- a/Hardware/CPU/GenericCPU.cs	Thu Sep 30 20:59:21 2010 +0000
     2.2 +++ b/Hardware/CPU/GenericCPU.cs	Fri Oct 01 19:01:09 2010 +0000
     2.3 @@ -119,14 +119,24 @@
     2.4            ActivateSensor(totalLoad);
     2.5        }
     2.6  
     2.7 -      if (hasTimeStampCounter)
     2.8 -        estimatedTimeStampCounterFrequency = EstimateTimeStampCounterFrequency();
     2.9 -      else
    2.10 +      if (hasTimeStampCounter) {
    2.11 +        estimatedTimeStampCounterFrequency = 
    2.12 +          EstimateTimeStampCounterFrequency();
    2.13 +        
    2.14 +        // set initial values 
    2.15 +        uint lsb, msb;
    2.16 +        WinRing0.RdtscTx(out lsb, out msb, (UIntPtr)1);
    2.17 +        lastTime = Stopwatch.GetTimestamp();
    2.18 +        lastTimeStampCount = ((ulong)msb << 32) | lsb;
    2.19 +
    2.20 +      } else {
    2.21          estimatedTimeStampCounterFrequency = 0;
    2.22 -      timeStampCounterFrequency = estimatedTimeStampCounterFrequency;
    2.23  
    2.24 -      lastTimeStampCount = 0;
    2.25 -      lastTime = 0;
    2.26 +        lastTime = 0;
    2.27 +        lastTimeStampCount = 0;
    2.28 +      }
    2.29 +
    2.30 +      timeStampCounterFrequency = estimatedTimeStampCounterFrequency;                  
    2.31      }
    2.32  
    2.33      private static double EstimateTimeStampCounterFrequency() {
     3.1 --- a/Properties/AssemblyVersion.cs	Thu Sep 30 20:59:21 2010 +0000
     3.2 +++ b/Properties/AssemblyVersion.cs	Fri Oct 01 19:01:09 2010 +0000
     3.3 @@ -37,5 +37,5 @@
     3.4  
     3.5  using System.Reflection;
     3.6  
     3.7 -[assembly: AssemblyVersion("0.1.37.23")]
     3.8 -[assembly: AssemblyInformationalVersion("0.1.37.23 Alpha")]
     3.9 \ No newline at end of file
    3.10 +[assembly: AssemblyVersion("0.1.37.24")]
    3.11 +[assembly: AssemblyInformationalVersion("0.1.37.24 Alpha")]
    3.12 \ No newline at end of file