Пример #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);
        }
Пример #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);
        }
Пример #3
0
 private uint NvGetAllClockFrequenciesV2(int busId, uint clockId, uint clockType)
 {
     try {
         NvGpuClockFrequenciesV2 info = NvGetAllClockFrequenciesV2(busId, clockType);
         if (clockId < info.domain.Length)
         {
             NvGpuClockRrequenciesDomain domain = info.domain[clockId];
             if (domain.bIsPresent == 1 && info.ClockType == clockType)
             {
                 return(domain.frequency);
             }
         }
     }
     catch {
     }
     return(0);
 }