using System.Linq; using NvAPIWrapper.Native.GPU; using NvAPIWrapper.Native.Interfaces.GPU; namespace NvAPIWrapper.GPU { /// /// Represents a performance state /// public class GPUPerformanceState { // ReSharper disable once TooManyDependencies internal GPUPerformanceState( int index, IPerformanceState20 performanceState, IPerformanceStates20ClockEntry[] statesClockEntries, IPerformanceStates20VoltageEntry[] baseVoltageEntries, PCIeInformation pcieInformation) { StateIndex = index; StateId = performanceState.StateId; IsReadOnly = !performanceState.IsEditable; Clocks = statesClockEntries.Select(entry => new GPUPerformanceStateClock(entry)).ToArray(); Voltages = baseVoltageEntries.Select(entry => new GPUPerformanceStateVoltage(entry)).ToArray(); PCIeInformation = pcieInformation; } /// /// Gets a list of clocks associated with this performance state /// public GPUPerformanceStateClock[] Clocks { get; } /// /// Gets a boolean value indicating if this performance state is readonly /// public bool IsReadOnly { get; } /// /// Gets the PCI-e information regarding this performance state. /// public PCIeInformation PCIeInformation { get; } /// /// Gets the performance state identification /// public PerformanceStateId StateId { get; } /// /// Gets the state index /// public int StateIndex { get; } /// /// Gets a list of voltages associated with this performance state /// public GPUPerformanceStateVoltage[] Voltages { get; } /// public override string ToString() { if (IsReadOnly) { return $"{StateId} (ReadOnly)"; } return StateId.ToString(); } } }