Add support for multiple processor groups.

Merge from upstream.
This commit is contained in:
Phyxion
2020-05-11 13:29:52 +02:00
parent a18136b55e
commit 3cc3d9139c
22 changed files with 390 additions and 135 deletions
@@ -209,6 +209,12 @@ namespace LibreHardwareMonitor.Interop
[DllImport(DllName, CallingConvention = CallingConvention.Winapi)]
internal static extern IntPtr GetCurrentThread();
[DllImport(DllName, CallingConvention = CallingConvention.Winapi)]
public static extern ushort GetActiveProcessorGroupCount();
[DllImport(DllName, CallingConvention = CallingConvention.Winapi)]
public static extern bool SetThreadGroupAffinity(IntPtr thread, ref GROUP_AFFINITY groupAffinity, out GROUP_AFFINITY previousGroupAffinity);
[DllImport(DllName, CallingConvention = CallingConvention.Winapi)]
internal static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize, MEM flAllocationType, PAGE flProtect);
@@ -245,6 +251,18 @@ namespace LibreHardwareMonitor.Interop
[DllImport(DllName, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
internal static extern int GetSystemFirmwareTable(Provider firmwareTableProviderSignature, int firmwareTableID, IntPtr firmwareTableBuffer, int bufferSize);
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct GROUP_AFFINITY
{
public UIntPtr Mask;
[MarshalAs(UnmanagedType.U2)]
public ushort Group;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.U2)]
public ushort[] Reserved;
}
internal enum DFP : uint
{
DFP_GET_VERSION = 0x00074080,
+6 -6
View File
@@ -36,7 +36,7 @@ namespace LibreHardwareMonitor.Interop
return true;
}
if (Software.OperatingSystem.IsLinux)
if (Software.OperatingSystem.IsUnix)
{
try
{
@@ -151,7 +151,7 @@ namespace LibreHardwareMonitor.Interop
{
if (IsAvailable)
{
if (Software.OperatingSystem.IsLinux)
if (Software.OperatingSystem.IsUnix)
{
nvmlShutdown();
}
@@ -171,7 +171,7 @@ namespace LibreHardwareMonitor.Interop
if (IsAvailable)
{
NvmlDevice nvmlDevice;
if (Software.OperatingSystem.IsLinux)
if (Software.OperatingSystem.IsUnix)
{
try
{
@@ -199,7 +199,7 @@ namespace LibreHardwareMonitor.Interop
if (IsAvailable)
{
NvmlDevice nvmlDevice;
if (Software.OperatingSystem.IsLinux)
if (Software.OperatingSystem.IsUnix)
{
if (nvmlDeviceGetHandleByPciBusId(pciBusId, out nvmlDevice) == NvmlReturn.Success)
return nvmlDevice;
@@ -218,7 +218,7 @@ namespace LibreHardwareMonitor.Interop
if (IsAvailable)
{
int powerUsage;
if (Software.OperatingSystem.IsLinux)
if (Software.OperatingSystem.IsUnix)
{
if (nvmlDeviceGetPowerUsage(nvmlDevice, out powerUsage) == NvmlReturn.Success)
return powerUsage;
@@ -237,7 +237,7 @@ namespace LibreHardwareMonitor.Interop
if (IsAvailable)
{
uint pcieThroughput;
if (Software.OperatingSystem.IsLinux)
if (Software.OperatingSystem.IsUnix)
{
if (nvmlDeviceGetPcieThroughput(nvmlDevice, counter, out pcieThroughput) == NvmlReturn.Success)
return pcieThroughput;