mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 14:25:16 +00:00
Release version 0.1.10. Changed core count for Intel Core i5/i7 CPUs. Added CpuidEx function.
This commit is contained in:
BIN
External/WinRing0.dll
vendored
BIN
External/WinRing0.dll
vendored
Binary file not shown.
BIN
External/WinRing0x64.dll
vendored
BIN
External/WinRing0x64.dll
vendored
Binary file not shown.
@@ -65,7 +65,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
coreCount = (cpuidExtData[8, 2] & 0xFF) + 1;
|
coreCount = (cpuidExtData[8, 2] & 0xFF) + 1;
|
||||||
|
|
||||||
// AMD family 10h processors support only one temperature sensor
|
// AMD family 10h processors support only one temperature sensor
|
||||||
coreTemperature = new Sensor("Core", 0, SensorType.Temperature, this);
|
coreTemperature = new Sensor(
|
||||||
|
"Core" + (coreCount > 1 ? " #1 - #" + coreCount : ""), 0,
|
||||||
|
SensorType.Temperature, this);
|
||||||
|
|
||||||
pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID,
|
pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID,
|
||||||
PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID, 0);
|
PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID, 0);
|
||||||
|
@@ -50,7 +50,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
private Sensor[] coreTemperatures;
|
private Sensor[] coreTemperatures;
|
||||||
|
|
||||||
private float tjMax = 0;
|
private float tjMax = 0;
|
||||||
|
private uint logicalProcessors;
|
||||||
private uint logicalProcessorsPerCore;
|
private uint logicalProcessorsPerCore;
|
||||||
|
private uint coreCount;
|
||||||
|
|
||||||
private const uint IA32_THERM_STATUS_MSR = 0x019C;
|
private const uint IA32_THERM_STATUS_MSR = 0x019C;
|
||||||
private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
|
private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
|
||||||
@@ -61,17 +63,22 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
|
this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
|
||||||
|
|
||||||
uint logicalProcessors = 1;
|
logicalProcessorsPerCore = 1;
|
||||||
if (cpuidData.GetLength(0) > 0x04)
|
if (cpuidData.GetLength(0) > 0x0B) {
|
||||||
|
uint eax, ebx, ecx, edx;
|
||||||
|
WinRing0.CpuidEx(0x0B, 0, out eax, out ebx, out ecx, out edx);
|
||||||
|
logicalProcessorsPerCore = ebx & 0xFF;
|
||||||
|
WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx);
|
||||||
|
logicalProcessors = ebx & 0xFF;
|
||||||
|
} else if (cpuidData.GetLength(0) > 0x04) {
|
||||||
logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1;
|
logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1;
|
||||||
|
|
||||||
logicalProcessorsPerCore = 1;
|
logicalProcessorsPerCore = 1;
|
||||||
if (cpuidData.GetLength(0) > 0x0B)
|
} else {
|
||||||
logicalProcessorsPerCore = cpuidData[0x0B, 1] & 0xFF;
|
logicalProcessors = 1;
|
||||||
if (logicalProcessorsPerCore == 0)
|
|
||||||
logicalProcessorsPerCore = 1;
|
logicalProcessorsPerCore = 1;
|
||||||
|
}
|
||||||
|
|
||||||
uint coreCount = logicalProcessors / logicalProcessorsPerCore;
|
coreCount = logicalProcessors / logicalProcessorsPerCore;
|
||||||
|
|
||||||
switch (family) {
|
switch (family) {
|
||||||
case 0x06: {
|
case 0x06: {
|
||||||
@@ -147,7 +154,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
r.AppendLine("Intel CPU");
|
r.AppendLine("Intel CPU");
|
||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
r.AppendFormat("Name: {0}{1}", name, Environment.NewLine);
|
r.AppendFormat("Name: {0}{1}", name, Environment.NewLine);
|
||||||
r.AppendFormat("Number of cores: {0}{1}", coreTemperatures.Length,
|
r.AppendFormat("Number of cores: {0}{1}", coreCount,
|
||||||
|
Environment.NewLine);
|
||||||
|
r.AppendFormat("Threads per core: {0}{1}", logicalProcessorsPerCore,
|
||||||
Environment.NewLine);
|
Environment.NewLine);
|
||||||
r.AppendFormat("TjMax: {0}{1}", tjMax, Environment.NewLine);
|
r.AppendFormat("TjMax: {0}{1}", tjMax, Environment.NewLine);
|
||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
|
@@ -79,8 +79,10 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
|
|
||||||
public delegate uint GetDllStatusDelegate();
|
public delegate uint GetDllStatusDelegate();
|
||||||
public delegate bool IsCpuidDelegate();
|
public delegate bool IsCpuidDelegate();
|
||||||
public delegate bool CpuidDelegate(uint index, out uint eax, out uint ebx,
|
public delegate bool CpuidDelegate(uint index,
|
||||||
out uint ecx, out uint edx);
|
out uint eax, out uint ebx, out uint ecx, out uint edx);
|
||||||
|
public delegate bool CpuidExDelegate(uint index, uint ecxValue,
|
||||||
|
out uint eax, out uint ebx, out uint ecx, out uint edx);
|
||||||
public delegate bool RdmsrPxDelegate(uint index, ref uint eax, ref uint edx,
|
public delegate bool RdmsrPxDelegate(uint index, ref uint eax, ref uint edx,
|
||||||
UIntPtr processAffinityMask);
|
UIntPtr processAffinityMask);
|
||||||
public delegate byte ReadIoPortByteDelegate(ushort port);
|
public delegate byte ReadIoPortByteDelegate(ushort port);
|
||||||
@@ -99,6 +101,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
public static GetDllStatusDelegate GetDllStatus;
|
public static GetDllStatusDelegate GetDllStatus;
|
||||||
public static IsCpuidDelegate IsCpuid;
|
public static IsCpuidDelegate IsCpuid;
|
||||||
public static CpuidDelegate Cpuid;
|
public static CpuidDelegate Cpuid;
|
||||||
|
public static CpuidExDelegate CpuidEx;
|
||||||
public static RdmsrPxDelegate RdmsrPx;
|
public static RdmsrPxDelegate RdmsrPx;
|
||||||
public static ReadIoPortByteDelegate ReadIoPortByte;
|
public static ReadIoPortByteDelegate ReadIoPortByte;
|
||||||
public static WriteIoPortByteDelegate WriteIoPortByte;
|
public static WriteIoPortByteDelegate WriteIoPortByte;
|
||||||
@@ -107,7 +110,6 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
public static ReadPciConfigDwordExDelegate ReadPciConfigDwordEx;
|
public static ReadPciConfigDwordExDelegate ReadPciConfigDwordEx;
|
||||||
public static WritePciConfigDwordExDelegate WritePciConfigDwordEx;
|
public static WritePciConfigDwordExDelegate WritePciConfigDwordEx;
|
||||||
|
|
||||||
|
|
||||||
private static void GetDelegate<T>(string entryPoint, out T newDelegate)
|
private static void GetDelegate<T>(string entryPoint, out T newDelegate)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
@@ -125,6 +127,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
GetDelegate("GetDllStatus", out GetDllStatus);
|
GetDelegate("GetDllStatus", out GetDllStatus);
|
||||||
GetDelegate("IsCpuid", out IsCpuid);
|
GetDelegate("IsCpuid", out IsCpuid);
|
||||||
GetDelegate("Cpuid", out Cpuid);
|
GetDelegate("Cpuid", out Cpuid);
|
||||||
|
GetDelegate("CpuidEx", out CpuidEx);
|
||||||
GetDelegate("RdmsrPx", out RdmsrPx);
|
GetDelegate("RdmsrPx", out RdmsrPx);
|
||||||
GetDelegate("ReadIoPortByte", out ReadIoPortByte);
|
GetDelegate("ReadIoPortByte", out ReadIoPortByte);
|
||||||
GetDelegate("WriteIoPortByte", out WriteIoPortByte);
|
GetDelegate("WriteIoPortByte", out WriteIoPortByte);
|
||||||
|
@@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.1.9.0")]
|
[assembly: AssemblyVersion("0.1.10.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.9.0")]
|
[assembly: AssemblyFileVersion("0.1.10.0")]
|
||||||
|
Reference in New Issue
Block a user