MangoHud/src/loaders/loader_nvml.h

57 lines
1.7 KiB
C
Raw Permalink Normal View History

2020-02-01 01:28:31 +00:00
// This is generated file. Do not modify directly.
// Path to the code generator: /home/crz/git/MangoHud/generate_library_loader.py .
#ifndef LIBRARY_LOADER_NVML_H
#define LIBRARY_LOADER_NVML_H
#if USE_SYSTEM_NVML
#include <nvml.h>
#else
2020-02-01 01:28:31 +00:00
#include "nvml.h"
#endif
2020-02-01 01:28:31 +00:00
#define LIBRARY_LOADER_NVML_H_DLOPEN
#include <string>
#include <dlfcn.h>
class libnvml_loader {
public:
libnvml_loader();
2020-02-02 22:14:44 +00:00
libnvml_loader(const std::string& library_name) : libnvml_loader() {
Load(library_name);
}
2020-02-01 01:28:31 +00:00
~libnvml_loader();
bool Load(const std::string& library_name);
bool IsLoaded() { return loaded_; }
decltype(&::nvmlInit_v2) nvmlInit_v2;
decltype(&::nvmlShutdown) nvmlShutdown;
decltype(&::nvmlDeviceGetUtilizationRates) nvmlDeviceGetUtilizationRates;
decltype(&::nvmlDeviceGetTemperature) nvmlDeviceGetTemperature;
decltype(&::nvmlDeviceGetPciInfo_v3) nvmlDeviceGetPciInfo_v3;
decltype(&::nvmlDeviceGetCount_v2) nvmlDeviceGetCount_v2;
decltype(&::nvmlDeviceGetHandleByIndex_v2) nvmlDeviceGetHandleByIndex_v2;
decltype(&::nvmlDeviceGetHandleByPciBusId_v2) nvmlDeviceGetHandleByPciBusId_v2;
2020-02-04 06:11:13 +00:00
decltype(&::nvmlDeviceGetMemoryInfo) nvmlDeviceGetMemoryInfo;
2020-03-01 21:01:59 +00:00
decltype(&::nvmlDeviceGetClockInfo) nvmlDeviceGetClockInfo;
2020-04-10 22:01:37 +00:00
decltype(&::nvmlErrorString) nvmlErrorString;
2020-05-22 12:38:54 +00:00
decltype(&::nvmlDeviceGetPowerUsage) nvmlDeviceGetPowerUsage;
2020-02-01 01:28:31 +00:00
private:
void CleanUp(bool unload);
#if defined(LIBRARY_LOADER_NVML_H_DLOPEN)
2020-02-02 22:14:44 +00:00
void* library_ = nullptr;
2020-02-01 01:28:31 +00:00
#endif
bool loaded_;
// Disallow copy constructor and assignment operator.
libnvml_loader(const libnvml_loader&);
void operator=(const libnvml_loader&);
};
libnvml_loader& get_libnvml_loader();
2020-02-01 01:28:31 +00:00
#endif // LIBRARY_LOADER_NVML_H