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

Function UpdateConsole

PresentMon/Console.cpp:252–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void UpdateConsole(uint32_t processId, ProcessInfo const& processInfo)
253{
254 auto const& args = GetCommandLineArgs();
255
256 // Don't display non-target or empty processes
257 if (!processInfo.mIsTargetProcess ||
258 processInfo.mModuleName.empty() ||
259 processInfo.mSwapChain.empty()) {
260 return;
261 }
262
263 auto empty = true;
264
265 for (auto const& pair : processInfo.mSwapChain) {
266 auto address = pair.first;
267 auto const& chain = pair.second;
268
269 if (empty) {
270 empty = false;
271 ConsolePrintLn(L"%s[%d]:", processInfo.mModuleName.c_str(), processId);
272 }
273
274 ConsolePrint(L" %016llX", address);
275
276 if (chain.mUnifiedSwapChain.swapChain.lastPresent.has_value()) {
277 ConsolePrint(L" (%hs): SyncInterval=%d Flags=%d CPU=%.3fms (%.1f fps)",
278 RuntimeToString(chain.mUnifiedSwapChain.swapChain.lastPresent.value().runtime),
279 chain.mUnifiedSwapChain.swapChain.lastPresent.value().syncInterval,
280 chain.mUnifiedSwapChain.swapChain.lastPresent.value().presentFlags,
281 chain.mUnifiedSwapChain.avgCPUDuration,
282 CalculateFPSForPrintf(chain.mUnifiedSwapChain.avgCPUDuration));
283
284 if (args.mTrackDisplay) {
285 ConsolePrint(L" Display=%.3fms (%.1f fps)",
286 chain.mUnifiedSwapChain.avgDisplayedTime,
287 CalculateFPSForPrintf(chain.mUnifiedSwapChain.avgDisplayedTime));
288 }
289
290 if (args.mTrackGPU) {
291 ConsolePrint(L" GPU=%.3fms", chain.mUnifiedSwapChain.avgGPUDuration);
292 }
293
294 if (args.mTrackDisplay) {
295 ConsolePrint(L" Latency=%.3fms %hs",
296 chain.mUnifiedSwapChain.avgDisplayLatency,
297 PresentModeToString(chain.mUnifiedSwapChain.swapChain.lastPresent.value().presentMode));
298 }
299 }
300
301 ConsolePrintLn(L"");
302 }
303
304 if (!empty) {
305 ConsolePrintLn(L"");
306 }
307}
308
309static int PrintColor(WORD color, wchar_t const* format, va_list val)

Callers 1

OutputFunction · 0.85

Calls 6

RuntimeToStringFunction · 0.85
CalculateFPSForPrintfFunction · 0.85
PresentModeToStringFunction · 0.85
emptyMethod · 0.80
ConsolePrintLnFunction · 0.70
ConsolePrintFunction · 0.70

Tested by

no test coverage detected