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

Method PollStaticQuery

IntelPresentMon/PresentMonMiddleware/Middleware.cpp:284–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 }
283
284 void Middleware::PollStaticQuery(const PM_QUERY_ELEMENT& element, uint32_t processId, uint8_t* pBlob)
285 {
286 if (pBlob == nullptr) {
287 throw Except<ipc::PmStatusError>(PM_STATUS_BAD_ARGUMENT, "pBlob pointer is null.");
288 }
289 const ipc::StaticMetricValue value = [&]() {
290 if (element.deviceId == ipc::kSystemDeviceId) {
291 return pComms_->GetSystemDataStore().FindStaticMetric(element.metric);
292 }
293 if (element.deviceId == ipc::kUniversalDeviceId) {
294 return pComms_->GetFrameDataStore(processId).FindStaticMetric(element.metric);
295 }
296 return pComms_->GetGpuDataStore(element.deviceId).FindStaticMetric(element.metric);
297 }();
298
299 std::visit([&](auto&& v) {
300 using T = std::decay_t<decltype(v)>;
301 // need stringcopy instead of memcpy for string type data (null terminator)
302 if constexpr (std::is_same_v<T, const char*>) {
303 strncpy_s(reinterpret_cast<char*>(pBlob), PM_MAX_PATH, v, _TRUNCATE);
304 }
305 else {
306 std::memcpy(pBlob, &v, sizeof(v));
307 }
308 }, value);
309 }
310
311 PM_FRAME_QUERY* mid::Middleware::RegisterFrameEventQuery(std::span<PM_QUERY_ELEMENT> queryElements, uint32_t& blobSize)
312 {

Callers 3

PollMethod · 0.80
GatherFromStatic_Method · 0.80
PresentMonAPI.cppFile · 0.80

Calls 2

visitFunction · 0.85
FindStaticMetricMethod · 0.80

Tested by

no test coverage detected