public override void Update() { foreach (var clock in clocks) { NVML.NvmlDeviceGetClockInfo(handle, (NvmlClockType)clock.Index, out uint clockMhz); clock.Value = clockMhz; } NVML.NvmlDeviceGetTemperature(handle, NvmlTemperatureSensors.GPU, out uint temp); thermal.Value = temp; NVML.NvmlDeviceGetFanSpeed(handle, out uint fanSpeed); fan.Value = fanSpeed; NVML.NvmlDeviceGetPowerUsage(handle, out uint powerUsage); powers[0].Value = powerUsage / 1000.0f; NVML.NvmlDeviceGetPowerManagementDefaultLimit(handle, out uint tdp); powers[1].Value = powerUsage * 100.0f / tdp; NvmlUtilization util = new NvmlUtilization(); NVML.NvmlDeviceGetUtilizationRates(handle, ref util); loads[0].Value = util.gpu; loads[1].Value = util.memory; NVML.NvmlDeviceGetDecoderUtilization(handle, out uint videoUtil, out uint vidSamPer); loads[2].Value = videoUtil; NvmlMemory memInfo = new NvmlMemory(); NVML.NvmlDeviceGetMemoryInfo(handle, ref memInfo); memory[0].Value = 100.0f * memInfo.used / memInfo.total; memory[1].Value = (float)(memInfo.total / byteConv); memory[2].Value = (float)(memInfo.used / byteConv); memory[3].Value = (float)(memInfo.free / byteConv); }
public static extern NvmlReturn NvmlDeviceGetUtilizationRates( NvmlDevice device, ref NvmlUtilization utilization);