Hardware/CPU/IntelCPU.cs
changeset 167 b7cc9d09aefe
parent 166 fa9dfbfc4145
child 182 4801e9eaf979
     1.1 --- a/Hardware/CPU/IntelCPU.cs	Thu Aug 12 20:53:27 2010 +0000
     1.2 +++ b/Hardware/CPU/IntelCPU.cs	Sun Aug 15 14:46:58 2010 +0000
     1.3 @@ -253,7 +253,7 @@
     1.4        get { return HardwareType.CPU; }
     1.5      }
     1.6  
     1.7 -    private void AppendMSRData(StringBuilder r, uint msr, int thread) {
     1.8 +    private static void AppendMSRData(StringBuilder r, uint msr, int thread) {
     1.9        uint eax, edx;
    1.10        if (WinRing0.RdmsrTx(msr, out eax, out edx, (UIntPtr)(1L << thread))) {
    1.11          r.Append(" ");
    1.12 @@ -298,7 +298,7 @@
    1.13        return r.ToString();
    1.14      }
    1.15  
    1.16 -    private double EstimateMaxClock(double timeWindow) {
    1.17 +    private static double EstimateMaxClock(double timeWindow) {
    1.18        long ticks = (long)(timeWindow * Stopwatch.Frequency);
    1.19        uint lsbBegin, msbBegin, lsbEnd, msbEnd; 
    1.20        
    1.21 @@ -359,7 +359,7 @@
    1.22            else
    1.23              maxClock = estimatedMaxClock;
    1.24  
    1.25 -          double busClock = 0;
    1.26 +          double newBusClock = 0;
    1.27            uint eax, edx;
    1.28            for (int i = 0; i < coreClocks.Length; i++) {
    1.29              System.Threading.Thread.Sleep(1);
    1.30 @@ -369,7 +369,7 @@
    1.31                  uint nehalemMultiplier = eax & 0xff;
    1.32                  coreClocks[i].Value =
    1.33                    (float)(nehalemMultiplier * maxClock / maxNehalemMultiplier);
    1.34 -                busClock = (float)(maxClock / maxNehalemMultiplier);
    1.35 +                newBusClock = (float)(maxClock / maxNehalemMultiplier);
    1.36                } else { // Core 2
    1.37                  uint multiplier = (eax >> 8) & 0x1f;
    1.38                  uint maxMultiplier = (edx >> 8) & 0x1f;
    1.39 @@ -378,7 +378,7 @@
    1.40                  uint maxFactor = (maxMultiplier << 1) | ((edx >> 14) & 1);
    1.41                  if (maxFactor > 0) {
    1.42                    coreClocks[i].Value = (float)(factor * maxClock / maxFactor);
    1.43 -                  busClock = (float)(2 * maxClock / maxFactor);
    1.44 +                  newBusClock = (float)(2 * maxClock / maxFactor);
    1.45                  }
    1.46                }
    1.47              } else { // Intel Pentium 4
    1.48 @@ -386,8 +386,8 @@
    1.49                coreClocks[i].Value = (float)maxClock;
    1.50              }
    1.51            }
    1.52 -          if (busClock > 0) {
    1.53 -            this.busClock.Value = (float)busClock;
    1.54 +          if (newBusClock > 0) {
    1.55 +            this.busClock.Value = (float)newBusClock;
    1.56              ActivateSensor(this.busClock);
    1.57            }
    1.58          }