Esempio n. 1
0
 private static bool NvPowerPoliciesSetStatus(int busId, ref NvGpuPowerStatus info)
 {
     if (NvapiNativeMethods.NvPowerPoliciesSetStatus == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         var r = NvapiNativeMethods.NvPowerPoliciesSetStatus(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvPowerPoliciesSetStatus)} {r.ToString()}");
         }
         if (r == NvStatus.NVAPI_OK)
         {
             return(true);
         }
     }
     catch {
     }
     return(false);
 }
Esempio n. 2
0
 private bool NvPowerPoliciesGetStatus(int busId, out NvGpuPowerStatus info)
 {
     info = new NvGpuPowerStatus();
     if (NvapiNativeMethods.NvPowerPoliciesGetStatus == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPowerStatus))));
         var r = NvapiNativeMethods.NvPowerPoliciesGetStatus(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvPowerPoliciesGetStatus)} {r.ToString()}");
             return(false);
         }
         return(true);
     }
     catch {
     }
     return(false);
 }
Esempio n. 3
0
 private bool NvPowerPoliciesSetStatus(int busId, ref NvGpuPowerStatus info)
 {
     if (NvapiNativeMethods.NvPowerPoliciesSetStatus == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPowerStatus))));
         var r = NvapiNativeMethods.NvPowerPoliciesSetStatus(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvPowerPoliciesSetStatus)} {r}");
         }
         if (r == NvStatus.NVAPI_OK)
         {
             return(true);
         }
     }
     catch {
     }
     return(false);
 }
Esempio n. 4
0
 private bool NvPowerPoliciesGetStatus(int busId, out NvGpuPowerStatus info)
 {
     info = new NvGpuPowerStatus();
     if (NvapiNativeMethods.NvPowerPoliciesGetStatus == null)
     {
         return(false);
     }
     try {
         info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPowerStatus))));
         var r = NvapiNativeMethods.NvPowerPoliciesGetStatus(HandlesByBusId[busId], ref info);
         if (r != NvStatus.OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvPowerPoliciesGetStatus)} {r}");
             return(false);
         }
         return(true);
     }
     catch {
     }
     return(false);
 }