//Init Nvidia GPU param public GPUParam(NvPhysicalGpuHandle hdl, NvDisplayHandle displ, int num) { handle = hdl; displayHandle = displ; type = GPUType.nvi; //GPU name string tmp; if (NVAPI.NvAPI_GPU_GetFullName(handle, out tmp) == NvStatus.OK) { GPUName = "NVIDIA " + tmp.Trim(); } else { GPUName = "NVIDIA GPU name not found"; } //Slot if (NVAPI.NvAPI_GPU_GetBusId != null) { uint busId = 0; if (NVAPI.NvAPI_GPU_GetBusId(handle, out busId) == NvStatus.OK) { Slot = (int)busId; } else { Slot = -1; } } //Subsys if (NVAPI.NvAPI_GPU_GetPCIIdentifiers != null) { uint deviceId, subSystemId, revisionId, extDeviceId; NvStatus status = NVAPI.NvAPI_GPU_GetPCIIdentifiers(handle, out deviceId, out subSystemId, out revisionId, out extDeviceId); if (status == NvStatus.OK) { Subsys = subSystemId.ToString("X", CultureInfo.InvariantCulture); if (Subsys.Length < 8) { Subsys = "0" + Subsys; } } } //Param GPU GPUParams = new List <OneParam>(); for (int i = 0; i != num; i++) { GPUParams.Insert(i, new OneParam()); } }
public NvidiaGPU(int adapterIndex, NvPhysicalGpuHandle handl, NvDisplayHandle displayHandle) { this.adapterIndex = adapterIndex; this.handle = handl; this.displayHandle = displayHandle; gpustat = new NviGPUStat(); gpucurr = new NviGPUInfoNum(); gpuinfo = new NviGPUInfo(); gpuinfo.GPUName = GetName(); if (NVAPI.NvAPI_GPU_GetBusId != null) { uint busId = 0; NvStatus status = NVAPI.NvAPI_GPU_GetBusId(handle, out busId); if (status == NvStatus.OK) { gpuinfo.Slot = (int)busId; } } if (NVAPI.NvAPI_GPU_GetPCIIdentifiers != null) { uint deviceId, subSystemId, revisionId, extDeviceId; NvStatus status = NVAPI.NvAPI_GPU_GetPCIIdentifiers(handle, out deviceId, out subSystemId, out revisionId, out extDeviceId); if (status == NvStatus.OK) { gpuinfo.Subsys = subSystemId.ToString("X", CultureInfo.InvariantCulture); if (gpuinfo.Subsys.Length < 8) { gpuinfo.Subsys = "0" + gpuinfo.Subsys; } } } //Переменная задает время сбора статистики, при цикле 1 сек статистика будет формироваться за последние 5 минут. statcount = 60; Update(); }