MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / NvmlWrapper

Method NvmlWrapper

IntelPresentMon/ControlLib/NvmlWrapper.cpp:8–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6namespace pwr::nv
7{
8 NvmlWrapper::NvmlWrapper()
9 {
10 // get init proc, throw if not found
11 const auto pInit_v2 = static_cast<nvmlReturn_t(*)()>(dll.GetProcAddress("nvmlInit_v2"));
12 if (!pInit_v2)
13 {
14 throw std::runtime_error{ "Failed to get init proc for nvml" };
15 }
16
17 // get shutdown proc, but don't throw if not found (non-critical)
18 // TODO: log error if not found
19 pShutdown = static_cast<decltype(pShutdown)>(dll.GetProcAddress("nvmlShutdown"));
20
21 // try and get all other procs, but don't throw if not found
22 // TODO: log error for any not found
23#define X_(name, ...) p##name = static_cast<decltype(p##name)>(dll.GetProcAddress("nvml"#name));
24 NVW_NVML_ENDPOINT_LIST
25#undef X_
26
27 // initialize nvml
28 if (!Ok(pInit_v2()))
29 {
30 throw std::runtime_error{ "nvml init call failed" };
31 }
32 }
33
34 NvmlWrapper::~NvmlWrapper()
35 {

Callers

nothing calls this directly

Calls 1

GetProcAddressMethod · 0.80

Tested by

no test coverage detected