using System.Collections.Generic;
using System.Linq;
using NvAPIWrapper.Native;
using NvAPIWrapper.Native.GPU;
namespace NvAPIWrapper.GPU
{
///
/// Contains information regarding the GPU performance control and limitations
///
public class GPUPerformanceControl
{
internal GPUPerformanceControl(PhysicalGPU physicalGPU)
{
PhysicalGPU = physicalGPU;
}
///
/// Gets the current active performance limitation
///
public PerformanceLimit CurrentActiveLimit
{
get => GPUApi.PerformancePoliciesGetStatus(PhysicalGPU.Handle).PerformanceLimit;
}
///
/// Gets the current performance decrease reason
///
public PerformanceDecreaseReason CurrentPerformanceDecreaseReason
{
get => GPUApi.GetPerformanceDecreaseInfo(PhysicalGPU.Handle);
}
///
/// Gets a boolean value indicating if no load limit is supported with this GPU
///
public bool IsNoLoadLimitSupported
{
get => GPUApi.PerformancePoliciesGetInfo(PhysicalGPU.Handle).IsNoLoadLimitSupported;
}
///
/// Gets a boolean value indicating if power limit is supported with this GPU
///
public bool IsPowerLimitSupported
{
get => GPUApi.PerformancePoliciesGetInfo(PhysicalGPU.Handle).IsPowerLimitSupported;
}
///
/// Gets a boolean value indicating if temperature limit is supported with this GPU
///
public bool IsTemperatureLimitSupported
{
get => GPUApi.PerformancePoliciesGetInfo(PhysicalGPU.Handle).IsTemperatureLimitSupported;
}
///
/// Gets a boolean value indicating if voltage limit is supported with this GPU
///
public bool IsVoltageLimitSupported
{
get => GPUApi.PerformancePoliciesGetInfo(PhysicalGPU.Handle).IsVoltageLimitSupported;
}
///
/// Gets the physical GPU that this instance describes
///
public PhysicalGPU PhysicalGPU { get; }
///
/// Gets information regarding possible power limit policies and their acceptable range
///
public IEnumerable PowerLimitInformation
{
get
{
return GPUApi.ClientPowerPoliciesGetInfo(PhysicalGPU.Handle).PowerPolicyInfoEntries
.Select(entry => new GPUPowerLimitInfo(entry));
}
}
///
/// Gets the current active power limit policies
///
public IEnumerable PowerLimitPolicies
{
get
{
// TODO: GPUApi.ClientPowerPoliciesSetStatus();
return GPUApi.ClientPowerPoliciesGetStatus(PhysicalGPU.Handle).PowerPolicyStatusEntries
.Select(entry => new GPUPowerLimitPolicy(entry));
}
}
///
/// Gets information regarding possible thermal limit policies and their acceptable range
///
public IEnumerable ThermalLimitInformation
{
get
{
return GPUApi.GetThermalPoliciesInfo(PhysicalGPU.Handle).ThermalPoliciesInfoEntries
.Select(entry => new GPUThermalLimitInfo(entry));
}
}
///
/// Gets the current active thermal limit policies
///
public IEnumerable ThermalLimitPolicies
{
get
{
// TODO: GPUApi.SetThermalPoliciesStatus();
return GPUApi.GetThermalPoliciesStatus(PhysicalGPU.Handle).ThermalPoliciesStatusEntries
.Select(entry => new GPUThermalLimitPolicy(entry));
}
}
}
}