| 61 | |
| 62 | template<class Tutorial> |
| 63 | static 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 | } |
nothing calls this directly
no test coverage detected