using NvAPIWrapper.Native.Exceptions; using NvAPIWrapper.Native.General; using NvAPIWrapper.Native.GPU.Structures; using NvAPIWrapper.Native.Helpers; using NvAPIWrapper.Native.Helpers.Structures; namespace NvAPIWrapper.Native { public static partial class GPUApi { /// /// [PRIVATE] /// Gets the current power policies information for the passed GPU handle. /// /// The handle of the GPU to perform the operation on. /// The current power policies information. public static PrivatePowerPoliciesInfoV1 ClientPowerPoliciesGetInfo(PhysicalGPUHandle gpuHandle) { var instance = typeof(PrivatePowerPoliciesInfoV1).Instantiate(); using (var policiesInfoReference = ValueTypeReference.FromValueType(instance)) { var status = DelegateFactory.GetDelegate()(gpuHandle, policiesInfoReference); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return policiesInfoReference.ToValueType( typeof(PrivatePowerPoliciesInfoV1)); } } /// /// [PRIVATE] /// Gets the power policies status for the passed GPU handle. /// /// The handle of the GPU to perform the operation on. /// The power policies status. public static PrivatePowerPoliciesStatusV1 ClientPowerPoliciesGetStatus(PhysicalGPUHandle gpuHandle) { var instance = typeof(PrivatePowerPoliciesStatusV1).Instantiate(); using (var policiesStatusReference = ValueTypeReference.FromValueType(instance)) { var status = DelegateFactory.GetDelegate()( gpuHandle, policiesStatusReference ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return policiesStatusReference.ToValueType( typeof(PrivatePowerPoliciesStatusV1)); } } /// /// [PRIVATE] /// Sets the power policies status for the passed GPU handle. /// /// The handle of the GPU to perform the operation on. /// The new power limiter policy. public static void ClientPowerPoliciesSetStatus( PhysicalGPUHandle gpuHandle, PrivatePowerPoliciesStatusV1 policiesStatus) { using (var policiesStatusReference = ValueTypeReference.FromValueType(policiesStatus)) { var status = DelegateFactory.GetDelegate()( gpuHandle, policiesStatusReference ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } } } /// /// [PRIVATE] /// Gets the power topology status for the passed GPU handle. /// /// The handle of the GPU to perform the operation on. /// The power topology status. public static PrivatePowerTopologiesStatusV1 ClientPowerTopologyGetStatus(PhysicalGPUHandle gpuHandle) { var instance = typeof(PrivatePowerTopologiesStatusV1).Instantiate(); using (var topologiesStatusReference = ValueTypeReference.FromValueType(instance)) { var status = DelegateFactory.GetDelegate()( gpuHandle, topologiesStatusReference ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return topologiesStatusReference.ToValueType( typeof(PrivatePowerTopologiesStatusV1)); } } } }