/// <summary> /// [PRIVATE] /// This function sets the performance states (P-States) 2.0 information. /// P-States are GPU active/executing performance capability and power consumption states. /// </summary> /// <param name="physicalGPUHandle">GPU handle to get information about.</param> /// <param name="performanceStates20Info">Performance status 2.0 information to set</param> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: gpuHandle is NULL</exception> /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle</exception> public static void SetPerformanceStates20( PhysicalGPUHandle physicalGPUHandle, IPerformanceStates20Info performanceStates20Info) { using (var performanceStateInfo = ValueTypeReference.FromValueType(performanceStates20Info, performanceStates20Info.GetType())) { var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_SetPStates20>()( physicalGPUHandle, performanceStateInfo ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } } }
internal GPUPerformanceStatesInformation( IPerformanceStates20Info states20Info, PerformanceStateId currentPerformanceStateId, PrivatePCIeInfoV2?pciInformation) { IsReadOnly = !states20Info.IsEditable; GlobalVoltages = states20Info.GeneralVoltages .Select(entry => new GPUPerformanceStateVoltage(entry)) .ToArray(); var clocks = states20Info.Clocks; var baseVoltages = states20Info.Voltages; PerformanceStates = states20Info.PerformanceStates.Select((state20, i) => { PCIeInformation statePCIeInfo = null; if (pciInformation != null && pciInformation.Value.PCIePerformanceStateInfos.Length > i) { statePCIeInfo = new PCIeInformation(pciInformation.Value.PCIePerformanceStateInfos[i]); } return(new GPUPerformanceState( i, state20, clocks[state20.StateId], baseVoltages[state20.StateId], statePCIeInfo )); }).ToArray(); CurrentPerformanceState = PerformanceStates.FirstOrDefault(performanceState => performanceState.StateId == currentPerformanceStateId); }