Ejemplo n.º 1
0
        private NvGpuClockFrequenciesV2 NvGetAllClockFrequenciesV2(int busId, uint type)
        {
            NvGpuClockFrequenciesV2 info = new NvGpuClockFrequenciesV2();

            if (NvapiNativeMethods.NvGetAllClockFrequenciesV2 == null)
            {
                return(info);
            }
            try {
                info.version   = (uint)(VERSION2 | (Marshal.SizeOf(typeof(NvGpuClockFrequenciesV2))));
                info.ClockType = type;
                var r = NvapiNativeMethods.NvGetAllClockFrequenciesV2(HandlesByBusId[busId], ref info);
                if (r != NvStatus.OK)
                {
                    Write.DevError($"{nameof(NvapiNativeMethods.NvGetAllClockFrequenciesV2)} {r}");
                }
                if (r == NvStatus.OK)
                {
                    return(info);
                }
            }
            catch {
            }
            return(info);
        }
Ejemplo n.º 2
0
        private NvGpuClockFrequenciesV2 NvGetAllClockFrequenciesV2(int busId, uint type)
        {
            NvGpuClockFrequenciesV2 info = new NvGpuClockFrequenciesV2();

            if (NvapiNativeMethods.NvGetAllClockFrequenciesV2 == null)
            {
                return(info);
            }
            try {
                if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle))
                {
                    return(info);
                }
                info.version   = (uint)(VERSION2 | (Marshal.SizeOf(typeof(NvGpuClockFrequenciesV2))));
                info.ClockType = type;
                var r = NvapiNativeMethods.NvGetAllClockFrequenciesV2(handle, ref info);
                if (r != NvStatus.NVAPI_OK)
                {
                    NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvGetAllClockFrequenciesV2)} {r.ToString()}");
                }
                if (r == NvStatus.NVAPI_OK)
                {
                    return(info);
                }
            }
            catch {
            }
            return(info);
        }