Ejemplo n.º 1
0
 private static bool NvSetPStateV2(int busId, ref NvGpuPerfPStates20InfoV2 info)
 {
     if (NvapiNativeMethods.NvSetPStateV2 == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         var r = NvapiNativeMethods.NvSetPStateV2(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvSetPStateV2)} {r.ToString()}");
         }
         if (r == NvStatus.NVAPI_OK)
         {
             return(true);
         }
     }
     catch {
     }
     return(false);
 }
Ejemplo n.º 2
0
 private bool NvGetPStateV2(int busId, out NvGpuPerfPStates20InfoV2 info)
 {
     info = new NvGpuPerfPStates20InfoV2();
     if (NvapiNativeMethods.NvGetPStateV2 == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         info.version = (uint)(VERSION2 | (Marshal.SizeOf(typeof(NvGpuPerfPStates20InfoV2))));
         var r = NvapiNativeMethods.NvGetPStateV2(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvGetPStateV2)} {r.ToString()}");
             return(false);
         }
         return(true);
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(false);
     }
 }
Ejemplo n.º 3
0
 private bool NvSetPStateV2(int busId, ref NvGpuPerfPStates20InfoV2 info)
 {
     if (NvapiNativeMethods.NvSetPStateV2 == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         info.version = (uint)(VERSION2 | (Marshal.SizeOf(typeof(NvGpuPerfPStates20InfoV2))));
         var r = NvapiNativeMethods.NvSetPStateV2(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvSetPStateV2)} {r.ToString()}");
         }
         if (r == NvStatus.NVAPI_OK)
         {
             return(true);
         }
     }
     catch {
     }
     return(false);
 }
Ejemplo n.º 4
0
 private bool NvSetPStateV2(int busId, ref NvGpuPerfPStates20InfoV2 info)
 {
     if (NvapiNativeMethods.NvSetPStateV2 == null)
     {
         return(false);
     }
     try {
         info.version = (uint)(VERSION2 | (Marshal.SizeOf(typeof(NvGpuPerfPStates20InfoV2))));
         var r = NvapiNativeMethods.NvSetPStateV2(HandlesByBusId[busId], ref info);
         if (r != NvStatus.OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvSetPStateV2)} {r}");
         }
         if (r == NvStatus.OK)
         {
             return(true);
         }
     }
     catch {
     }
     return(false);
 }
Ejemplo n.º 5
0
 private bool NvGetPStateV2(int busId, out NvGpuPerfPStates20InfoV2 info)
 {
     info = new NvGpuPerfPStates20InfoV2();
     if (NvapiNativeMethods.NvGetPStateV2 == null)
     {
         return(false);
     }
     try {
         info.version = (uint)(VERSION2 | (Marshal.SizeOf(typeof(NvGpuPerfPStates20InfoV2))));
         var r = NvapiNativeMethods.NvGetPStateV2(HandlesByBusId[busId], ref info);
         if (r != NvStatus.OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvGetPStateV2)} {r}");
             return(false);
         }
         return(true);
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(false);
     }
 }