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