| 267 | __attribute__((noinline)) static double bench(Func fn, int iterations, int warmup = 200) { |
| 268 | #else |
| 269 | __attribute__((noinline)) static double bench(Func fn, int iterations, int warmup = 2) { |
| 270 | #endif |
| 271 | for (int i = 0; i < warmup; ++i) |
| 272 | fn(); |
| 273 | fl::u32 t0 = fl::micros(); |
| 274 | for (int i = 0; i < iterations; ++i) |
| 275 | fn(); |
| 276 | fl::u32 t1 = fl::micros(); |
| 277 | return static_cast<double>(t1 - t0) * 1000.0 / |
| 278 | static_cast<double>(iterations); // ns per iteration |
| 279 | } |
| 280 | |
| 281 | template <int R, int W, int H> |
| 282 | __attribute__((noinline)) static void run_benchmark(const char *label, int iters) { |
no test coverage detected