Skip to content

Commit cc93fda

Browse files
committed
add benchmark to measure time taken till first render pass
1 parent d38f5fa commit cc93fda

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

62_CAD/main.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ using namespace video;
2525

2626
#include "nbl/video/surface/CSurfaceVulkan.h"
2727
#include "nbl/ext/FullScreenTriangle/FullScreenTriangle.h"
28+
#include <chrono>
29+
30+
#define BENCHMARK_TILL_FIRST_FRAME
2831

2932
static constexpr bool DebugMode = false;
3033
static constexpr bool DebugRotatingViewProj = false;
@@ -836,6 +839,16 @@ class ComputerAidedDesign final : public examples::SimpleWindowedApplication, pu
836839
addObjects(intendedNextSubmit);
837840

838841
endFrameRender(intendedNextSubmit);
842+
843+
#ifdef BENCHMARK_TILL_FIRST_FRAME
844+
if (!stopBenchamrkFlag)
845+
{
846+
const std::chrono::steady_clock::time_point stopBenchmark = std::chrono::high_resolution_clock::now();
847+
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(stopBenchmark - startBenchmark);
848+
std::cout << "Time taken till first render pass: " << duration.count() << " milliseconds" << std::endl;
849+
stopBenchamrkFlag = true;
850+
}
851+
#endif
839852
}
840853

841854
bool beginFrameRender()
@@ -2555,6 +2568,11 @@ class ComputerAidedDesign final : public examples::SimpleWindowedApplication, pu
25552568
smart_refctd_ptr<IWindow> m_window;
25562569
smart_refctd_ptr<CSimpleResizeSurface<CSwapchainResources>> m_surface;
25572570
smart_refctd_ptr<IGPUImageView> pseudoStencilImageView;
2571+
2572+
#ifdef BENCHMARK_TILL_FIRST_FRAME
2573+
const std::chrono::steady_clock::time_point startBenchmark = std::chrono::high_resolution_clock::now();
2574+
bool stopBenchamrkFlag = false;
2575+
#endif
25582576
};
25592577

25602578
NBL_MAIN_FUNC(ComputerAidedDesign)

0 commit comments

Comments
 (0)