MCPcopy Create free account
hub / github.com/RenderKit/embree / renderBenchmarkLegacy

Function renderBenchmarkLegacy

tutorials/common/tutorial/benchmark_render.h:63–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61
62template<class Tutorial>
63static void renderBenchmarkLegacy(BenchState& state, BenchParams& params ,int argc, char** argv)
64{
65 Tutorial tutorial;
66 tutorial.interactive = false;
67 tutorial.main(argc,argv);
68
69 tutorial.resize(tutorial.width, tutorial.height);
70 ISPCCamera ispccamera = tutorial.camera.getISPCCamera(tutorial.width, tutorial.height);
71
72 IOStreamStateRestorer cout_state(std::cout);
73 std::cout.setf(std::ios::fixed, std::ios::floatfield);
74 std::cout.precision(4);
75
76 //Statistics stat;
77 FilteredStatistics fpsStat(0.5f,0.0f);
78 FilteredStatistics mraypsStat(0.5f,0.0f);
79 {
80 size_t numTotalFrames = params.skipIterations + params.minTimeOrIterations;
81 for (size_t i=0; i<params.skipIterations; i++)
82 {
83 tutorial.initRayStats();
84 double t0 = getSeconds();
85 tutorial.render(tutorial.pixels,tutorial.width,tutorial.height,0.0f,ispccamera);
86 double t1 = getSeconds();
87 double dt = t1-t0;
88 if (ispccamera.render_time != 0.0)
89 dt = ispccamera.render_time;
90 std::cout << "frame [" << std::setw(3) << i << " / " << std::setw(3) << numTotalFrames << "]: " << std::setw(8) << 1.0/dt << " fps (skipped)" << std::endl << std::flush;
91 }
92
93 for (size_t i=params.skipIterations; i<numTotalFrames; i++)
94 {
95 tutorial.initRayStats();
96 double t0 = getSeconds();
97 tutorial.render(tutorial.pixels,tutorial.width,tutorial.height,0.0f,ispccamera);
98 double t1 = getSeconds();
99 double dt = t1-t0;
100 if (ispccamera.render_time != 0.0)
101 dt = ispccamera.render_time;
102
103 float fps = float(1.0/dt);
104 fpsStat.add(fps);
105
106 float mrayps = float(double(tutorial.getNumRays())/(1000000.0*dt));
107 mraypsStat.add(mrayps);
108
109 if (numTotalFrames >= 1024 && (i % 64 == 0))
110 {
111 double rate = 0;
112 if (fpsStat.getAvg() != 0.0) rate = 100.0f*fpsStat.getSigma()/fpsStat.getAvg();
113
114 std::cout << "frame [" << std::setw(3) << i << " / " << std::setw(3) << numTotalFrames << "]: "
115 << std::setw(8) << fps << " fps, "
116 << "min = " << std::setw(8) << fpsStat.getMin() << " fps, "
117 << "avg = " << std::setw(8) << fpsStat.getAvg() << " fps, "
118 << "max = " << std::setw(8) << fpsStat.getMax() << " fps, "
119 << "sigma = " << std::setw(6) << fpsStat.getSigma() << " (" << rate << "%)" << std::endl << std::flush;
120 }

Callers

nothing calls this directly

Calls 13

getSecondsFunction · 0.85
getISPCCameraMethod · 0.80
initRayStatsMethod · 0.80
renderMethod · 0.80
getNumRaysMethod · 0.80
mainMethod · 0.45
resizeMethod · 0.45
addMethod · 0.45
getAvgMethod · 0.45
getSigmaMethod · 0.45
getMinMethod · 0.45
getMaxMethod · 0.45

Tested by

no test coverage detected