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