get nvidia vram from nvml

pull/20/head
FlightlessMango 4 years ago committed by jackun
parent 5201a26d95
commit d97719e3d6
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -29,7 +29,7 @@ class libnvml_loader {
decltype(&::nvmlDeviceGetCount_v2) nvmlDeviceGetCount_v2;
decltype(&::nvmlDeviceGetHandleByIndex_v2) nvmlDeviceGetHandleByIndex_v2;
decltype(&::nvmlDeviceGetHandleByPciBusId_v2) nvmlDeviceGetHandleByPciBusId_v2;
decltype(&::nvmlDeviceGetMemoryInfo) nvmlDeviceGetMemoryInfo;
private:
void CleanUp(bool unload);

@ -7,6 +7,7 @@ extern unsigned int nvidiaTemp, processSamplesCount, lastSeenTimeStamp, *vgpuIns
extern nvmlValueType_t *sampleValType;
extern nvmlDevice_t nvidiaDevice;
extern struct nvmlUtilization_st nvidiaUtilization;
extern struct nvmlMemory_st nvidiaMemory;
extern bool nvmlSuccess;
bool checkNvidia(void);

@ -8,6 +8,7 @@ nvmlDevice_t nvidiaDevice;
bool nvmlSuccess = false;
unsigned int nvidiaTemp;
struct nvmlUtilization_st nvidiaUtilization;
struct nvmlMemory_st nvidiaMemory;
bool checkNvidia(){
if (nvml.IsLoaded()){
@ -28,4 +29,5 @@ void getNvidiaInfo(){
nvml.nvmlDeviceGetHandleByIndex(0, &nvidiaDevice);
nvml.nvmlDeviceGetUtilizationRates(nvidiaDevice, &nvidiaUtilization);
nvml.nvmlDeviceGetTemperature(nvidiaDevice, NVML_TEMPERATURE_GPU, &nvidiaTemp);
nvml.nvmlDeviceGetMemoryInfo(nvidiaDevice, &nvidiaMemory);
}
Loading…
Cancel
Save