@@ -36,6 +36,7 @@ internal sealed class NvidiaGpu : GenericGpu
3636 private readonly Sensor _pcieThroughputTx ;
3737 private readonly Sensor [ ] _powers ;
3838 private readonly Sensor _powerUsage ;
39+ private readonly Sensor _coreVoltage ;
3940 private readonly Sensor [ ] _temperatures ;
4041 private readonly uint _thermalSensorsMask ;
4142
@@ -301,6 +302,15 @@ public NvidiaGpu(int adapterIndex, NvApi.NvPhysicalGpuHandle handle, NvApi.NvDis
301302 }
302303 }
303304
305+ // Voltage
306+ var voltageSensor = GetVoltRailsStatus ( out status ) ;
307+ if ( status == NvApi . NvStatus . OK )
308+ {
309+ _coreVoltage = new Sensor ( "GPU Core Voltage" , 0 , SensorType . Voltage , this , settings ) ;
310+
311+ ActivateSensor ( _coreVoltage ) ;
312+ }
313+
304314 if ( NvidiaML . IsAvailable || NvidiaML . Initialize ( ) )
305315 {
306316 if ( hasBusId )
@@ -608,6 +618,17 @@ public override void Update()
608618 }
609619 }
610620
621+ if ( _coreVoltage != null )
622+ {
623+ var voltageSensor = GetVoltRailsStatus ( out status ) ;
624+ if ( status == NvApi . NvStatus . OK )
625+ {
626+ var microvolts = ( ( ulong ) voltageSensor . CoreMicrovoltsHigh << 32 ) | voltageSensor . CoreMicrovolts ;
627+
628+ _coreVoltage . Value = microvolts == 0 ? 0 : microvolts / 1_000_000f ;
629+ }
630+ }
631+
611632 if ( _displayHandle != null )
612633 {
613634 NvApi . NvMemoryInfo memoryInfo = GetMemoryInfo ( out status ) ;
@@ -1032,6 +1053,23 @@ private NvApi.NvThermalSensors GetThermalSensors(uint mask, out NvApi.NvStatus s
10321053 return status == NvApi . NvStatus . OK ? thermalSensors : default ;
10331054 }
10341055
1056+ private NvApi . NvGpuClientVoltRailsStatus GetVoltRailsStatus ( out NvApi . NvStatus status )
1057+ {
1058+ if ( NvApi . NvAPI_GPU_ClientVoltRailsGetStatus == null )
1059+ {
1060+ status = NvApi . NvStatus . Error ;
1061+ return default ;
1062+ }
1063+
1064+ var voltRails = new NvApi . NvGpuClientVoltRailsStatus
1065+ {
1066+ Version = ( uint ) NvApi . MAKE_NVAPI_VERSION < NvApi . NvGpuClientVoltRailsStatus > ( 1 ) ,
1067+ } ;
1068+
1069+ status = NvApi . NvAPI_GPU_ClientVoltRailsGetStatus ( _handle , ref voltRails ) ;
1070+ return status == NvApi . NvStatus . OK ? voltRails : default ;
1071+ }
1072+
10351073 private NvApi . NvFanCoolersStatus GetFanCoolersStatus ( out NvApi . NvStatus status )
10361074 {
10371075 if ( NvApi . NvAPI_GPU_ClientFanCoolersGetStatus == null )
0 commit comments