FastLED 3.10.6
Loading...
Searching...
No Matches

◆ runWavePerf()

WavePerfResult fl::wave_perf::runWavePerf ( u32 W,
u32 H,
u32 iterations,
LaplacianStencil stencil )
inline

Definition at line 83 of file wave_perf_bench.h.

84 {
86 if (!isValidGrid(W, H) || !isValidIterations(iterations)) {
87 return r;
88 }
89 auto sim = makeBenchSim(W, H, stencil);
90 const u32 t0 = fl::micros();
91 for (u32 i = 0; i < iterations; ++i) {
92 sim->update();
93 }
94 const u32 t1 = fl::micros();
95 r.success = true;
96 r.total_us = t1 - t0;
97 const double cells_per_update = static_cast<double>(W) * H;
98 r.us_per_update = static_cast<double>(r.total_us)
99 / static_cast<double>(iterations);
100 r.us_per_cell_per_update = r.us_per_update / cells_per_update;
102 ? (1.0e6 / r.us_per_update) : 0.0;
103 return r;
104}
static const int H
Definition PerfDisc.ino:21
static const int W
Definition PerfDisc.ino:20
fl::unique_ptr< WaveSimulation2D_Real > makeBenchSim(u32 W, u32 H, LaplacianStencil stencil) FL_NO_EXCEPT
bool isValidIterations(u32 iterations) FL_NO_EXCEPT
bool isValidGrid(u32 W, u32 H) FL_NO_EXCEPT
fl::u32 micros()
Universal microsecond timer - returns microseconds since system startup.

References fl::FL_NO_EXCEPT, fl::wave_perf::WavePerfResult::fps_at_one_update_per_frame, H, isValidGrid(), isValidIterations(), makeBenchSim(), fl::micros(), fl::wave_perf::WavePerfResult::success, fl::wave_perf::WavePerfResult::total_us, fl::wave_perf::WavePerfResult::us_per_cell_per_update, fl::wave_perf::WavePerfResult::us_per_update, and W.

+ Here is the call graph for this function: