コード例 #1
0
 public void GetPowerFanTemp(int gpuIndex, out uint power, out uint fanSpeed, out int temp)
 {
     power    = 0;
     fanSpeed = 0;
     temp     = 0;
     if (!TryGetAtiGpu(gpuIndex, out ATIGPU gpu))
     {
         return;
     }
     try {
         if (gpu.OverdriveVersion < 8)
         {
             temp     = GetTemperature(gpuIndex);
             power    = GetPowerUsage(gpuIndex);
             fanSpeed = GetFanSpeed(gpuIndex);
         }
         else
         {
             ADLPMLogDataOutput logDataOutput = ADLPMLogDataOutput.Create();
             var r = AdlNativeMethods.ADL2_New_QueryPMLogData_Get(_context, gpu.AdapterIndex, ref logDataOutput);
             if (r < AdlStatus.ADL_OK)
             {
                 NTMinerConsole.DevError(() => $"{nameof(AdlNativeMethods.ADL2_New_QueryPMLogData_Get)} {r.ToString()}");
             }
             int i = (int)ADLSensorType.PMLOG_ASIC_POWER;
             if (i < logDataOutput.Sensors.Length && logDataOutput.Sensors[i].Supported != 0)
             {
                 power = (uint)logDataOutput.Sensors[i].Value;
             }
             i = (int)ADLSensorType.PMLOG_FAN_PERCENTAGE;
             if (i < logDataOutput.Sensors.Length && logDataOutput.Sensors[i].Supported != 0)
             {
                 fanSpeed = (uint)logDataOutput.Sensors[i].Value;
             }
             i = (int)ADLSensorType.PMLOG_TEMPERATURE_EDGE;
             if (i < logDataOutput.Sensors.Length && logDataOutput.Sensors[i].Supported != 0)
             {
                 temp = logDataOutput.Sensors[i].Value;
             }
         }
     }
     catch {
     }
 }