| 511 | } |
| 512 | |
| 513 | void WriteToCSV(std::optional<std::ofstream>& debugCsvFile, const std::string& processName, const unsigned int& processId, |
| 514 | PM_QUERY_ELEMENT(&queryElements)[29], pmapi::BlobContainer& blobs) |
| 515 | { |
| 516 | |
| 517 | if (!debugCsvFile.has_value()) { |
| 518 | return; |
| 519 | } |
| 520 | try { |
| 521 | for (auto pBlob : blobs) { |
| 522 | const auto swapChain = *reinterpret_cast<const uint64_t*>(&pBlob[queryElements[0].dataOffset]); |
| 523 | const auto graphicsRuntime = *reinterpret_cast<const PM_GRAPHICS_RUNTIME*>(&pBlob[queryElements[1].dataOffset]); |
| 524 | const auto syncInterval = *reinterpret_cast<const int32_t*>(&pBlob[queryElements[2].dataOffset]); |
| 525 | const auto presentFlags = *reinterpret_cast<const uint32_t*>(&pBlob[queryElements[3].dataOffset]); |
| 526 | const auto allowsTearing = *reinterpret_cast<const bool*>(&pBlob[queryElements[4].dataOffset]); |
| 527 | const auto presentMode = *reinterpret_cast<const PM_PRESENT_MODE*>(&pBlob[queryElements[5].dataOffset]); |
| 528 | const auto frameType = *reinterpret_cast<const PM_FRAME_TYPE*>(&pBlob[queryElements[6].dataOffset]); |
| 529 | const auto timeQpc = *reinterpret_cast<const uint64_t*>(&pBlob[queryElements[7].dataOffset]); |
| 530 | const auto msBetweenSimStartTime = *reinterpret_cast<const double*>(&pBlob[queryElements[8].dataOffset]); |
| 531 | const auto msBetweenPresents = *reinterpret_cast<const double*>(&pBlob[queryElements[9].dataOffset]); |
| 532 | const auto msBetweenDisplayChange = *reinterpret_cast<const double*>(&pBlob[queryElements[10].dataOffset]); |
| 533 | const auto msInPresentApi = *reinterpret_cast<const double*>(&pBlob[queryElements[11].dataOffset]); |
| 534 | const auto msRenderPresentLatency = *reinterpret_cast<const double*>(&pBlob[queryElements[12].dataOffset]); |
| 535 | const auto msUntilDisplayed = *reinterpret_cast<const double*>(&pBlob[queryElements[13].dataOffset]); |
| 536 | const auto msPcLatency = *reinterpret_cast<const double*>(&pBlob[queryElements[14].dataOffset]); |
| 537 | const auto cpuStartQpc = *reinterpret_cast<const uint64_t*>(&pBlob[queryElements[15].dataOffset]); |
| 538 | const auto msBetweenAppStart = *reinterpret_cast<const double*>(&pBlob[queryElements[16].dataOffset]); |
| 539 | const auto msCpuBusy = *reinterpret_cast<const double*>(&pBlob[queryElements[17].dataOffset]); |
| 540 | const auto msCpuWait = *reinterpret_cast<const double*>(&pBlob[queryElements[18].dataOffset]); |
| 541 | const auto msGpuLatency = *reinterpret_cast<const double*>(&pBlob[queryElements[19].dataOffset]); |
| 542 | const auto msGpuTime = *reinterpret_cast<const double*>(&pBlob[queryElements[20].dataOffset]); |
| 543 | const auto msGpuBusy = *reinterpret_cast<const double*>(&pBlob[queryElements[21].dataOffset]); |
| 544 | const auto msGpuWait = *reinterpret_cast<const double*>(&pBlob[queryElements[22].dataOffset]); |
| 545 | const auto msAnimationError = *reinterpret_cast<const double*>(&pBlob[queryElements[23].dataOffset]); |
| 546 | const auto animationTime = *reinterpret_cast<const double*>(&pBlob[queryElements[24].dataOffset]); |
| 547 | const auto msFlipDelay = *reinterpret_cast<const double*>(&pBlob[queryElements[25].dataOffset]); |
| 548 | const auto msAllInputToPhotonLatency = *reinterpret_cast<const double*>(&pBlob[queryElements[26].dataOffset]); |
| 549 | const auto msClickToPhotonLatency = *reinterpret_cast<const double*>(&pBlob[queryElements[27].dataOffset]); |
| 550 | const auto msInstrumentedLatency = *reinterpret_cast<const double*>(&pBlob[queryElements[28].dataOffset]); |
| 551 | *debugCsvFile << processName << ","; |
| 552 | *debugCsvFile << processId << ","; |
| 553 | *debugCsvFile << std::hex << "0x" << std::dec << swapChain << ","; |
| 554 | *debugCsvFile << TranslateGraphicsRuntime(graphicsRuntime) << ","; |
| 555 | *debugCsvFile << syncInterval << ","; |
| 556 | *debugCsvFile << presentFlags << ","; |
| 557 | *debugCsvFile << allowsTearing << ","; |
| 558 | *debugCsvFile << TranslatePresentMode(presentMode) << ","; |
| 559 | *debugCsvFile << TranslateFrameType(frameType) << ","; |
| 560 | *debugCsvFile << timeQpc << ","; // Time in QPC |
| 561 | *debugCsvFile << msBetweenSimStartTime << ","; |
| 562 | *debugCsvFile << msBetweenPresents << ","; |
| 563 | *debugCsvFile << msBetweenDisplayChange << ","; |
| 564 | *debugCsvFile << msInPresentApi << ","; |
| 565 | *debugCsvFile << msRenderPresentLatency << ","; |
| 566 | *debugCsvFile << msUntilDisplayed << ","; |
| 567 | *debugCsvFile << msPcLatency << ","; |
| 568 | *debugCsvFile << cpuStartQpc << ","; |
| 569 | *debugCsvFile << msBetweenAppStart << ","; |
| 570 | *debugCsvFile << msCpuBusy << ","; |
no test coverage detected