mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 06:15:08 +00:00
Updated NvAPI_GPU_GetDynamicPstatesInfoEx and NvAPI_GPU_GetDynamicPstatesInfo NVAPI function interfaces.
This commit is contained in:
@@ -131,24 +131,40 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||||
internal struct NvPState {
|
internal struct NvUtilizationDomainEx {
|
||||||
public bool Present;
|
public bool Present;
|
||||||
public int Percentage;
|
public int Percentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
public enum UtilizationDomain {
|
||||||
internal struct NvPStates {
|
GPU,
|
||||||
public uint Version;
|
FrameBuffer,
|
||||||
public uint Flags;
|
VideoEngine,
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_PSTATES_PER_GPU)]
|
BusInterface
|
||||||
public NvPState[] PStates;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||||
internal struct NvUsages {
|
internal struct NvDynamicPstatesInfoEx {
|
||||||
public uint Version;
|
public uint Version;
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_USAGES_PER_GPU)]
|
public uint Flags;
|
||||||
public uint[] Usage;
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.NVAPI_MAX_GPU_UTILIZATIONS)]
|
||||||
|
public NvUtilizationDomainEx[] UtilizationDomains;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||||
|
internal struct NvUtilizationDomain {
|
||||||
|
public bool Present;
|
||||||
|
public int Percentage;
|
||||||
|
public ulong Reserved;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||||
|
internal struct NvDynamicPstatesInfo {
|
||||||
|
public uint Version;
|
||||||
|
public uint Flags;
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.NVAPI_MAX_GPU_UTILIZATIONS)]
|
||||||
|
public NvUtilizationDomain[] UtilizationDomains;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||||
@@ -189,7 +205,7 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
[StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||||
internal struct NvMemoryInfo {
|
internal struct NvDisplayDriverMemoryInfo {
|
||||||
public uint Version;
|
public uint Version;
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst =
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst =
|
||||||
NVAPI.MAX_MEMORY_VALUES_PER_GPU)]
|
NVAPI.MAX_MEMORY_VALUES_PER_GPU)]
|
||||||
@@ -214,8 +230,7 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
|
|
||||||
public const int MAX_THERMAL_SENSORS_PER_GPU = 3;
|
public const int MAX_THERMAL_SENSORS_PER_GPU = 3;
|
||||||
public const int MAX_CLOCKS_PER_GPU = 0x120;
|
public const int MAX_CLOCKS_PER_GPU = 0x120;
|
||||||
public const int MAX_PSTATES_PER_GPU = 8;
|
public const int NVAPI_MAX_GPU_UTILIZATIONS = 8;
|
||||||
public const int MAX_USAGES_PER_GPU = 33;
|
|
||||||
public const int MAX_COOLER_PER_GPU = 20;
|
public const int MAX_COOLER_PER_GPU = 20;
|
||||||
public const int MAX_MEMORY_VALUES_PER_GPU = 5;
|
public const int MAX_MEMORY_VALUES_PER_GPU = 5;
|
||||||
|
|
||||||
@@ -223,14 +238,14 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
Marshal.SizeOf(typeof(NvGPUThermalSettings)) | 0x10000;
|
Marshal.SizeOf(typeof(NvGPUThermalSettings)) | 0x10000;
|
||||||
public static readonly uint GPU_CLOCKS_VER = (uint)
|
public static readonly uint GPU_CLOCKS_VER = (uint)
|
||||||
Marshal.SizeOf(typeof(NvClocks)) | 0x20000;
|
Marshal.SizeOf(typeof(NvClocks)) | 0x20000;
|
||||||
public static readonly uint GPU_PSTATES_VER = (uint)
|
public static readonly uint GPU_DYNAMIC_PSTATES_INFO_EX_VER = (uint)
|
||||||
Marshal.SizeOf(typeof(NvPStates)) | 0x10000;
|
Marshal.SizeOf(typeof(NvDynamicPstatesInfoEx)) | 0x10000;
|
||||||
public static readonly uint GPU_USAGES_VER = (uint)
|
public static readonly uint GPU_DYNAMIC_PSTATES_INFO_VER = (uint)
|
||||||
Marshal.SizeOf(typeof(NvUsages)) | 0x10000;
|
Marshal.SizeOf(typeof(NvDynamicPstatesInfo)) | 0x10000;
|
||||||
public static readonly uint GPU_COOLER_SETTINGS_VER = (uint)
|
public static readonly uint GPU_COOLER_SETTINGS_VER = (uint)
|
||||||
Marshal.SizeOf(typeof(NvGPUCoolerSettings)) | 0x20000;
|
Marshal.SizeOf(typeof(NvGPUCoolerSettings)) | 0x20000;
|
||||||
public static readonly uint GPU_MEMORY_INFO_VER = (uint)
|
public static readonly uint DISPLAY_DRIVER_MEMORY_INFO_VER = (uint)
|
||||||
Marshal.SizeOf(typeof(NvMemoryInfo)) | 0x20000;
|
Marshal.SizeOf(typeof(NvDisplayDriverMemoryInfo)) | 0x20000;
|
||||||
public static readonly uint DISPLAY_DRIVER_VERSION_VER = (uint)
|
public static readonly uint DISPLAY_DRIVER_VERSION_VER = (uint)
|
||||||
Marshal.SizeOf(typeof(NvDisplayDriverVersion)) | 0x10000;
|
Marshal.SizeOf(typeof(NvDisplayDriverVersion)) | 0x10000;
|
||||||
public static readonly uint GPU_COOLER_LEVELS_VER = (uint)
|
public static readonly uint GPU_COOLER_LEVELS_VER = (uint)
|
||||||
@@ -272,12 +287,14 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
NvPhysicalGpuHandle gpuHandle, ref NvClocks nvClocks);
|
NvPhysicalGpuHandle gpuHandle, ref NvClocks nvClocks);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate NvStatus NvAPI_GPU_GetPStatesDelegate(
|
public delegate NvStatus NvAPI_GPU_GetDynamicPstatesInfoExDelegate(
|
||||||
NvPhysicalGpuHandle gpuHandle, ref NvPStates nvPStates);
|
NvPhysicalGpuHandle gpuHandle,
|
||||||
|
ref NvDynamicPstatesInfoEx nvDynamicPstatesInfoEx);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate NvStatus NvAPI_GPU_GetUsagesDelegate(
|
public delegate NvStatus NvAPI_GPU_GetDynamicPstatesInfoDelegate(
|
||||||
NvPhysicalGpuHandle gpuHandle, ref NvUsages nvUsages);
|
NvPhysicalGpuHandle gpuHandle,
|
||||||
|
ref NvDynamicPstatesInfo nvDynamicPstatesInfo);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate NvStatus NvAPI_GPU_GetCoolerSettingsDelegate(
|
public delegate NvStatus NvAPI_GPU_GetCoolerSettingsDelegate(
|
||||||
@@ -290,8 +307,8 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
ref NvGPUCoolerLevels NvGPUCoolerLevels);
|
ref NvGPUCoolerLevels NvGPUCoolerLevels);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate NvStatus NvAPI_GPU_GetMemoryInfoDelegate(
|
public delegate NvStatus NvAPI_GetDisplayDriverMemoryInfoDelegate(
|
||||||
NvDisplayHandle displayHandle, ref NvMemoryInfo nvMemoryInfo);
|
NvDisplayHandle displayHandle, ref NvDisplayDriverMemoryInfo nvMemoryInfo);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate NvStatus NvAPI_GetDisplayDriverVersionDelegate(
|
public delegate NvStatus NvAPI_GetDisplayDriverVersionDelegate(
|
||||||
@@ -331,16 +348,16 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
NvAPI_GPU_GetTachReading;
|
NvAPI_GPU_GetTachReading;
|
||||||
public static readonly NvAPI_GPU_GetAllClocksDelegate
|
public static readonly NvAPI_GPU_GetAllClocksDelegate
|
||||||
NvAPI_GPU_GetAllClocks;
|
NvAPI_GPU_GetAllClocks;
|
||||||
public static readonly NvAPI_GPU_GetPStatesDelegate
|
public static readonly NvAPI_GPU_GetDynamicPstatesInfoExDelegate
|
||||||
NvAPI_GPU_GetPStates;
|
NvAPI_GPU_GetDynamicPstatesInfoEx;
|
||||||
public static readonly NvAPI_GPU_GetUsagesDelegate
|
public static readonly NvAPI_GPU_GetDynamicPstatesInfoDelegate
|
||||||
NvAPI_GPU_GetUsages;
|
NvAPI_GPU_GetDynamicPstatesInfo;
|
||||||
public static readonly NvAPI_GPU_GetCoolerSettingsDelegate
|
public static readonly NvAPI_GPU_GetCoolerSettingsDelegate
|
||||||
NvAPI_GPU_GetCoolerSettings;
|
NvAPI_GPU_GetCoolerSettings;
|
||||||
public static readonly NvAPI_GPU_SetCoolerLevelsDelegate
|
public static readonly NvAPI_GPU_SetCoolerLevelsDelegate
|
||||||
NvAPI_GPU_SetCoolerLevels;
|
NvAPI_GPU_SetCoolerLevels;
|
||||||
public static readonly NvAPI_GPU_GetMemoryInfoDelegate
|
public static readonly NvAPI_GetDisplayDriverMemoryInfoDelegate
|
||||||
NvAPI_GPU_GetMemoryInfo;
|
NvAPI_GetDisplayDriverMemoryInfo;
|
||||||
public static readonly NvAPI_GetDisplayDriverVersionDelegate
|
public static readonly NvAPI_GetDisplayDriverVersionDelegate
|
||||||
NvAPI_GetDisplayDriverVersion;
|
NvAPI_GetDisplayDriverVersion;
|
||||||
public static readonly NvAPI_GPU_GetPCIIdentifiersDelegate
|
public static readonly NvAPI_GPU_GetPCIIdentifiersDelegate
|
||||||
@@ -414,11 +431,11 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
GetDelegate(0xE5AC921F, out NvAPI_EnumPhysicalGPUs);
|
GetDelegate(0xE5AC921F, out NvAPI_EnumPhysicalGPUs);
|
||||||
GetDelegate(0x5F608315, out NvAPI_GPU_GetTachReading);
|
GetDelegate(0x5F608315, out NvAPI_GPU_GetTachReading);
|
||||||
GetDelegate(0x1BD69F49, out NvAPI_GPU_GetAllClocks);
|
GetDelegate(0x1BD69F49, out NvAPI_GPU_GetAllClocks);
|
||||||
GetDelegate(0x60DED2ED, out NvAPI_GPU_GetPStates);
|
GetDelegate(0x60DED2ED, out NvAPI_GPU_GetDynamicPstatesInfoEx);
|
||||||
GetDelegate(0x189A1FDF, out NvAPI_GPU_GetUsages);
|
GetDelegate(0x189A1FDF, out NvAPI_GPU_GetDynamicPstatesInfo);
|
||||||
GetDelegate(0xDA141340, out NvAPI_GPU_GetCoolerSettings);
|
GetDelegate(0xDA141340, out NvAPI_GPU_GetCoolerSettings);
|
||||||
GetDelegate(0x891FA0AE, out NvAPI_GPU_SetCoolerLevels);
|
GetDelegate(0x891FA0AE, out NvAPI_GPU_SetCoolerLevels);
|
||||||
GetDelegate(0x774AA982, out NvAPI_GPU_GetMemoryInfo);
|
GetDelegate(0x774AA982, out NvAPI_GetDisplayDriverMemoryInfo);
|
||||||
GetDelegate(0xF951A4D1, out NvAPI_GetDisplayDriverVersion);
|
GetDelegate(0xF951A4D1, out NvAPI_GetDisplayDriverVersion);
|
||||||
GetDelegate(0x01053FA5, out _NvAPI_GetInterfaceVersionString);
|
GetDelegate(0x01053FA5, out _NvAPI_GetInterfaceVersionString);
|
||||||
GetDelegate(0x2DDFB66E, out NvAPI_GPU_GetPCIIdentifiers);
|
GetDelegate(0x2DDFB66E, out NvAPI_GPU_GetPCIIdentifiers);
|
||||||
|
@@ -76,11 +76,12 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
for (int i = 0; i < clocks.Length; i++)
|
for (int i = 0; i < clocks.Length; i++)
|
||||||
ActivateSensor(clocks[i]);
|
ActivateSensor(clocks[i]);
|
||||||
|
|
||||||
loads = new Sensor[3];
|
loads = new Sensor[4];
|
||||||
loads[0] = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
|
loads[0] = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
|
||||||
loads[1] = new Sensor("GPU Memory Controller", 1, SensorType.Load, this, settings);
|
loads[1] = new Sensor("GPU Frame Buffer", 1, SensorType.Load, this, settings);
|
||||||
loads[2] = new Sensor("GPU Video Engine", 2, SensorType.Load, this, settings);
|
loads[2] = new Sensor("GPU Video Engine", 2, SensorType.Load, this, settings);
|
||||||
memoryLoad = new Sensor("GPU Memory", 3, SensorType.Load, this, settings);
|
loads[3] = new Sensor("GPU Bus Interface", 3, SensorType.Load, this, settings);
|
||||||
|
memoryLoad = new Sensor("GPU Memory", 4, SensorType.Load, this, settings);
|
||||||
memoryFree = new Sensor("GPU Memory Free", 1, SensorType.SmallData, this, settings);
|
memoryFree = new Sensor("GPU Memory Free", 1, SensorType.SmallData, this, settings);
|
||||||
memoryUsed = new Sensor("GPU Memory Used", 2, SensorType.SmallData, this, settings);
|
memoryUsed = new Sensor("GPU Memory Used", 2, SensorType.SmallData, this, settings);
|
||||||
memoryAvail = new Sensor("GPU Memory Total", 3, SensorType.SmallData, this, settings);
|
memoryAvail = new Sensor("GPU Memory Total", 3, SensorType.SmallData, this, settings);
|
||||||
@@ -191,27 +192,31 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NvPStates states = new NvPStates();
|
var infoEx = new NvDynamicPstatesInfoEx();
|
||||||
states.Version = NVAPI.GPU_PSTATES_VER;
|
infoEx.Version = NVAPI.GPU_DYNAMIC_PSTATES_INFO_EX_VER;
|
||||||
states.PStates = new NvPState[NVAPI.MAX_PSTATES_PER_GPU];
|
infoEx.UtilizationDomains =
|
||||||
if (NVAPI.NvAPI_GPU_GetPStates != null &&
|
new NvUtilizationDomainEx[NVAPI.NVAPI_MAX_GPU_UTILIZATIONS];
|
||||||
NVAPI.NvAPI_GPU_GetPStates(handle, ref states) == NvStatus.OK) {
|
if (NVAPI.NvAPI_GPU_GetDynamicPstatesInfoEx != null &&
|
||||||
for (int i = 0; i < 3; i++)
|
NVAPI.NvAPI_GPU_GetDynamicPstatesInfoEx(handle, ref infoEx) == NvStatus.OK) {
|
||||||
if (states.PStates[i].Present) {
|
for (int i = 0; i < loads.Length; i++) {
|
||||||
loads[i].Value = states.PStates[i].Percentage;
|
if (infoEx.UtilizationDomains[i].Present) {
|
||||||
|
loads[i].Value = infoEx.UtilizationDomains[i].Percentage;
|
||||||
ActivateSensor(loads[i]);
|
ActivateSensor(loads[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
NvUsages usages = new NvUsages();
|
var info = new NvDynamicPstatesInfo();
|
||||||
usages.Version = NVAPI.GPU_USAGES_VER;
|
info.Version = NVAPI.GPU_DYNAMIC_PSTATES_INFO_VER;
|
||||||
usages.Usage = new uint[NVAPI.MAX_USAGES_PER_GPU];
|
info.UtilizationDomains =
|
||||||
if (NVAPI.NvAPI_GPU_GetUsages != null &&
|
new NvUtilizationDomain[NVAPI.NVAPI_MAX_GPU_UTILIZATIONS];
|
||||||
NVAPI.NvAPI_GPU_GetUsages(handle, ref usages) == NvStatus.OK) {
|
if (NVAPI.NvAPI_GPU_GetDynamicPstatesInfo != null &&
|
||||||
loads[0].Value = usages.Usage[2];
|
NVAPI.NvAPI_GPU_GetDynamicPstatesInfo(handle, ref info) == NvStatus.OK) {
|
||||||
loads[1].Value = usages.Usage[6];
|
for (int i = 0; i < loads.Length; i++) {
|
||||||
loads[2].Value = usages.Usage[10];
|
if (info.UtilizationDomains[i].Present) {
|
||||||
for (int i = 0; i < 3; i++)
|
loads[i].Value = info.UtilizationDomains[i].Percentage;
|
||||||
ActivateSensor(loads[i]);
|
ActivateSensor(loads[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,11 +227,11 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
ActivateSensor(control);
|
ActivateSensor(control);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvMemoryInfo memoryInfo = new NvMemoryInfo();
|
NvDisplayDriverMemoryInfo memoryInfo = new NvDisplayDriverMemoryInfo();
|
||||||
memoryInfo.Version = NVAPI.GPU_MEMORY_INFO_VER;
|
memoryInfo.Version = NVAPI.DISPLAY_DRIVER_MEMORY_INFO_VER;
|
||||||
memoryInfo.Values = new uint[NVAPI.MAX_MEMORY_VALUES_PER_GPU];
|
memoryInfo.Values = new uint[NVAPI.MAX_MEMORY_VALUES_PER_GPU];
|
||||||
if (NVAPI.NvAPI_GPU_GetMemoryInfo != null && displayHandle.HasValue &&
|
if (NVAPI.NvAPI_GetDisplayDriverMemoryInfo != null && displayHandle.HasValue &&
|
||||||
NVAPI.NvAPI_GPU_GetMemoryInfo(displayHandle.Value, ref memoryInfo) ==
|
NVAPI.NvAPI_GetDisplayDriverMemoryInfo(displayHandle.Value, ref memoryInfo) ==
|
||||||
NvStatus.OK) {
|
NvStatus.OK) {
|
||||||
uint totalMemory = memoryInfo.Values[0];
|
uint totalMemory = memoryInfo.Values[0];
|
||||||
uint freeMemory = memoryInfo.Values[4];
|
uint freeMemory = memoryInfo.Values[4];
|
||||||
@@ -382,19 +387,20 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NVAPI.NvAPI_GPU_GetPStates != null) {
|
if (NVAPI.NvAPI_GPU_GetDynamicPstatesInfoEx != null) {
|
||||||
NvPStates states = new NvPStates();
|
var info = new NvDynamicPstatesInfoEx();
|
||||||
states.Version = NVAPI.GPU_PSTATES_VER;
|
info.Version = NVAPI.GPU_DYNAMIC_PSTATES_INFO_EX_VER;
|
||||||
states.PStates = new NvPState[NVAPI.MAX_PSTATES_PER_GPU];
|
info.UtilizationDomains =
|
||||||
NvStatus status = NVAPI.NvAPI_GPU_GetPStates(handle, ref states);
|
new NvUtilizationDomainEx[NVAPI.NVAPI_MAX_GPU_UTILIZATIONS];
|
||||||
|
var status = NVAPI.NvAPI_GPU_GetDynamicPstatesInfoEx(handle, ref info);
|
||||||
|
|
||||||
r.AppendLine("P-States");
|
r.AppendLine("Utilization Domains Ex");
|
||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
if (status == NvStatus.OK) {
|
if (status == NvStatus.OK) {
|
||||||
for (int i = 0; i < states.PStates.Length; i++)
|
for (int i = 0; i < info.UtilizationDomains.Length; i++)
|
||||||
if (states.PStates[i].Present)
|
if (info.UtilizationDomains[i].Present)
|
||||||
r.AppendFormat(" Percentage[{0}]: {1}{2}", i,
|
r.AppendFormat(" Percentage[{0}]: {1}{2}", i,
|
||||||
states.PStates[i].Percentage, Environment.NewLine);
|
info.UtilizationDomains[i].Percentage, Environment.NewLine);
|
||||||
} else {
|
} else {
|
||||||
r.Append(" Status: ");
|
r.Append(" Status: ");
|
||||||
r.AppendLine(status.ToString());
|
r.AppendLine(status.ToString());
|
||||||
@@ -402,19 +408,20 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NVAPI.NvAPI_GPU_GetUsages != null) {
|
if (NVAPI.NvAPI_GPU_GetDynamicPstatesInfo != null) {
|
||||||
NvUsages usages = new NvUsages();
|
var info = new NvDynamicPstatesInfo();
|
||||||
usages.Version = NVAPI.GPU_USAGES_VER;
|
info.Version = NVAPI.GPU_DYNAMIC_PSTATES_INFO_VER;
|
||||||
usages.Usage = new uint[NVAPI.MAX_USAGES_PER_GPU];
|
info.UtilizationDomains =
|
||||||
NvStatus status = NVAPI.NvAPI_GPU_GetUsages(handle, ref usages);
|
new NvUtilizationDomain[NVAPI.NVAPI_MAX_GPU_UTILIZATIONS];
|
||||||
|
var status = NVAPI.NvAPI_GPU_GetDynamicPstatesInfo(handle, ref info);
|
||||||
|
|
||||||
r.AppendLine("Usages");
|
r.AppendLine("Utilization Domains");
|
||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
if (status == NvStatus.OK) {
|
if (status == NvStatus.OK) {
|
||||||
for (int i = 0; i < usages.Usage.Length; i++)
|
for (int i = 0; i < info.UtilizationDomains.Length; i++)
|
||||||
if (usages.Usage[i] > 0)
|
if (info.UtilizationDomains[i].Present)
|
||||||
r.AppendFormat(" Usage[{0}]: {1}{2}", i,
|
r.AppendFormat(" Percentage[{0}]: {1}{2}", i,
|
||||||
usages.Usage[i], Environment.NewLine);
|
info.UtilizationDomains[i].Percentage, Environment.NewLine);
|
||||||
} else {
|
} else {
|
||||||
r.Append(" Status: ");
|
r.Append(" Status: ");
|
||||||
r.AppendLine(status.ToString());
|
r.AppendLine(status.ToString());
|
||||||
@@ -465,12 +472,14 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NVAPI.NvAPI_GPU_GetMemoryInfo != null && displayHandle.HasValue) {
|
if (NVAPI.NvAPI_GetDisplayDriverMemoryInfo != null &&
|
||||||
NvMemoryInfo memoryInfo = new NvMemoryInfo();
|
displayHandle.HasValue)
|
||||||
memoryInfo.Version = NVAPI.GPU_MEMORY_INFO_VER;
|
{
|
||||||
|
NvDisplayDriverMemoryInfo memoryInfo = new NvDisplayDriverMemoryInfo();
|
||||||
|
memoryInfo.Version = NVAPI.DISPLAY_DRIVER_MEMORY_INFO_VER;
|
||||||
memoryInfo.Values = new uint[NVAPI.MAX_MEMORY_VALUES_PER_GPU];
|
memoryInfo.Values = new uint[NVAPI.MAX_MEMORY_VALUES_PER_GPU];
|
||||||
NvStatus status = NVAPI.NvAPI_GPU_GetMemoryInfo(displayHandle.Value,
|
NvStatus status = NVAPI.NvAPI_GetDisplayDriverMemoryInfo(
|
||||||
ref memoryInfo);
|
displayHandle.Value, ref memoryInfo);
|
||||||
|
|
||||||
r.AppendLine("Memory Info");
|
r.AppendLine("Memory Info");
|
||||||
r.AppendLine();
|
r.AppendLine();
|
||||||
|
Reference in New Issue
Block a user