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) { NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvGetPStateV1)} {r.ToString()}"); return(false); } return(true); } catch (Exception e) { Logger.ErrorDebugLine(e); return(false); } }
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); } }