Fixed the initialization of the TSC estimating code.

This commit is contained in:
Michael Möller
2010-10-01 19:01:09 +00:00
parent 1e21129803
commit 9619107616
3 changed files with 19 additions and 14 deletions

View File

@@ -64,8 +64,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
private double timeStampCounterMultiplier;
private StringBuilder debug = new StringBuilder();
public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
: base(processorIndex, cpuid, settings)
{
@@ -180,9 +178,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
CultureInfo.InvariantCulture));
r.AppendLine();
r.Append(debug);
r.AppendLine();
return r.ToString();
}

View File

@@ -119,14 +119,24 @@ namespace OpenHardwareMonitor.Hardware.CPU {
ActivateSensor(totalLoad);
}
if (hasTimeStampCounter)
estimatedTimeStampCounterFrequency = EstimateTimeStampCounterFrequency();
else
estimatedTimeStampCounterFrequency = 0;
timeStampCounterFrequency = estimatedTimeStampCounterFrequency;
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;
lastTimeStampCount = 0;
lastTime = 0;
} else {
estimatedTimeStampCounterFrequency = 0;
lastTime = 0;
lastTimeStampCount = 0;
}
timeStampCounterFrequency = estimatedTimeStampCounterFrequency;
}
private static double EstimateTimeStampCounterFrequency() {

View File

@@ -37,5 +37,5 @@
using System.Reflection;
[assembly: AssemblyVersion("0.1.37.23")]
[assembly: AssemblyInformationalVersion("0.1.37.23 Alpha")]
[assembly: AssemblyVersion("0.1.37.24")]
[assembly: AssemblyInformationalVersion("0.1.37.24 Alpha")]