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

Function LookupFrameId

PresentData/Debug.cpp:333–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333uint32_t LookupFrameId(
334 PMTraceConsumer* pmConsumer,
335 uint64_t CompositionSurfaceLuid,
336 uint64_t PresentCount,
337 uint64_t BindId)
338{
339 // pmConsumer can complete presents before they've seen all of
340 // their TokenStateChanged_Info events, so we keep a copy of the
341 // token->present id map here simply so we can print what present
342 // the event refers to.
343 static std::unordered_map<
344 PMTraceConsumer::Win32KPresentHistoryToken,
345 uint32_t,
346 PMTraceConsumer::Win32KPresentHistoryTokenHash> tokenToIdMap;
347
348 PMTraceConsumer::Win32KPresentHistoryToken key(CompositionSurfaceLuid, PresentCount, BindId);
349 auto ii = pmConsumer->mPresentByWin32KPresentHistoryToken.find(key);
350 if (ii != pmConsumer->mPresentByWin32KPresentHistoryToken.end()) {
351 tokenToIdMap[key] = ii->second->FrameId;
352 return ii->second->FrameId;
353 }
354
355 auto jj = tokenToIdMap.find(key);
356 if (jj != tokenToIdMap.end()) {
357 return jj->second;
358 }
359
360 return 0;
361}
362
363}
364

Callers 1

VerboseTraceEventImplFunction · 0.85

Calls 1

endMethod · 0.45

Tested by

no test coverage detected