1.1 --- a/Hardware/CPU/IntelCPU.cs Tue Feb 02 18:35:23 2010 +0000
1.2 +++ b/Hardware/CPU/IntelCPU.cs Tue Feb 02 21:58:54 2010 +0000
1.3 @@ -50,7 +50,9 @@
1.4 private Sensor[] coreTemperatures;
1.5
1.6 private float tjMax = 0;
1.7 + private uint logicalProcessors;
1.8 private uint logicalProcessorsPerCore;
1.9 + private uint coreCount;
1.10
1.11 private const uint IA32_THERM_STATUS_MSR = 0x019C;
1.12 private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
1.13 @@ -60,18 +62,23 @@
1.14
1.15 this.name = name;
1.16 this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
1.17 -
1.18 - uint logicalProcessors = 1;
1.19 - if (cpuidData.GetLength(0) > 0x04)
1.20 +
1.21 + logicalProcessorsPerCore = 1;
1.22 + if (cpuidData.GetLength(0) > 0x0B) {
1.23 + uint eax, ebx, ecx, edx;
1.24 + WinRing0.CpuidEx(0x0B, 0, out eax, out ebx, out ecx, out edx);
1.25 + logicalProcessorsPerCore = ebx & 0xFF;
1.26 + WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx);
1.27 + logicalProcessors = ebx & 0xFF;
1.28 + } else if (cpuidData.GetLength(0) > 0x04) {
1.29 logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1;
1.30 + logicalProcessorsPerCore = 1;
1.31 + } else {
1.32 + logicalProcessors = 1;
1.33 + logicalProcessorsPerCore = 1;
1.34 + }
1.35
1.36 - logicalProcessorsPerCore = 1;
1.37 - if (cpuidData.GetLength(0) > 0x0B)
1.38 - logicalProcessorsPerCore = cpuidData[0x0B, 1] & 0xFF;
1.39 - if (logicalProcessorsPerCore == 0)
1.40 - logicalProcessorsPerCore = 1;
1.41 -
1.42 - uint coreCount = logicalProcessors / logicalProcessorsPerCore;
1.43 + coreCount = logicalProcessors / logicalProcessorsPerCore;
1.44
1.45 switch (family) {
1.46 case 0x06: {
1.47 @@ -147,7 +154,9 @@
1.48 r.AppendLine("Intel CPU");
1.49 r.AppendLine();
1.50 r.AppendFormat("Name: {0}{1}", name, Environment.NewLine);
1.51 - r.AppendFormat("Number of cores: {0}{1}", coreTemperatures.Length,
1.52 + r.AppendFormat("Number of cores: {0}{1}", coreCount,
1.53 + Environment.NewLine);
1.54 + r.AppendFormat("Threads per core: {0}{1}", logicalProcessorsPerCore,
1.55 Environment.NewLine);
1.56 r.AppendFormat("TjMax: {0}{1}", tjMax, Environment.NewLine);
1.57 r.AppendLine();