Exemplo n.º 1
0
 private bool NvGetPStateV1(int busId, out NvGpuPerfPStates20InfoV1 info)
 {
     info = NvGpuPerfPStates20InfoV1.Create();
     if (NvapiNativeMethods.NvGetPStateV1 == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         var r = NvapiNativeMethods.NvGetPStateV1(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvGetPStateV1)} {r.ToString()}");
             return(false);
         }
         return(true);
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(false);
     }
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 private bool NvGetPStateV1(int busId, out NvGpuPerfPStates20InfoV1 info)
 {
     info = new NvGpuPerfPStates20InfoV1();
     if (NvapiNativeMethods.NvGetPStateV1 == null)
     {
         return(false);
     }
     try {
         if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
         {
             return(false);
         }
         info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPerfPStates20InfoV1))));
         var r = NvapiNativeMethods.NvGetPStateV1(handle, ref info);
         if (r != NvStatus.NVAPI_OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvGetPStateV1)} {r.ToString()}");
             return(false);
         }
         return(true);
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(false);
     }
 }
Exemplo n.º 4
0
 private bool NvGetPStateV1(int busId, out NvGpuPerfPStates20InfoV1 info)
 {
     info = new NvGpuPerfPStates20InfoV1();
     if (NvapiNativeMethods.NvGetPStateV1 == null)
     {
         return(false);
     }
     try {
         info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPerfPStates20InfoV1))));
         var r = NvapiNativeMethods.NvGetPStateV1(HandlesByBusId[busId], ref info);
         if (r != NvStatus.OK)
         {
             Write.DevError($"{nameof(NvapiNativeMethods.NvGetPStateV1)} {r}");
             return(false);
         }
         return(true);
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(false);
     }
 }
Exemplo n.º 5
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);
 }