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