# HG changeset patch # User moel.mich # Date 1285959669 0 # Node ID ca487ba88c2402af2bc4d9ff775263d725ad528f # Parent 551243a66b326d416d16f9ee01929a5a2b5fa9dd Fixed the initialization of the TSC estimating code. diff -r 551243a66b32 -r ca487ba88c24 Hardware/CPU/AMD10CPU.cs --- a/Hardware/CPU/AMD10CPU.cs Thu Sep 30 20:59:21 2010 +0000 +++ b/Hardware/CPU/AMD10CPU.cs Fri Oct 01 19:01:09 2010 +0000 @@ -64,8 +64,6 @@ private double timeStampCounterMultiplier; - private StringBuilder debug = new StringBuilder(); - public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings) : base(processorIndex, cpuid, settings) { @@ -180,9 +178,6 @@ CultureInfo.InvariantCulture)); r.AppendLine(); - r.Append(debug); - r.AppendLine(); - return r.ToString(); } diff -r 551243a66b32 -r ca487ba88c24 Hardware/CPU/GenericCPU.cs --- a/Hardware/CPU/GenericCPU.cs Thu Sep 30 20:59:21 2010 +0000 +++ b/Hardware/CPU/GenericCPU.cs Fri Oct 01 19:01:09 2010 +0000 @@ -119,14 +119,24 @@ ActivateSensor(totalLoad); } - if (hasTimeStampCounter) - estimatedTimeStampCounterFrequency = EstimateTimeStampCounterFrequency(); - else + if (hasTimeStampCounter) { + estimatedTimeStampCounterFrequency = + EstimateTimeStampCounterFrequency(); + + // set initial values + uint lsb, msb; + WinRing0.RdtscTx(out lsb, out msb, (UIntPtr)1); + lastTime = Stopwatch.GetTimestamp(); + lastTimeStampCount = ((ulong)msb << 32) | lsb; + + } else { estimatedTimeStampCounterFrequency = 0; - timeStampCounterFrequency = estimatedTimeStampCounterFrequency; - lastTimeStampCount = 0; - lastTime = 0; + lastTime = 0; + lastTimeStampCount = 0; + } + + timeStampCounterFrequency = estimatedTimeStampCounterFrequency; } private static double EstimateTimeStampCounterFrequency() { diff -r 551243a66b32 -r ca487ba88c24 Properties/AssemblyVersion.cs --- a/Properties/AssemblyVersion.cs Thu Sep 30 20:59:21 2010 +0000 +++ b/Properties/AssemblyVersion.cs Fri Oct 01 19:01:09 2010 +0000 @@ -37,5 +37,5 @@ using System.Reflection; -[assembly: AssemblyVersion("0.1.37.23")] -[assembly: AssemblyInformationalVersion("0.1.37.23 Alpha")] \ No newline at end of file +[assembly: AssemblyVersion("0.1.37.24")] +[assembly: AssemblyInformationalVersion("0.1.37.24 Alpha")] \ No newline at end of file