From ee425b55c48c25c7a91b6cba315e6c2cd42d0fb7 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Fri, 22 May 2026 21:08:04 +1000 Subject: refactor(bench): move bench printing to source file --- src/bench/bench.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/bench/bench.c (limited to 'src/bench') diff --git a/src/bench/bench.c b/src/bench/bench.c new file mode 100644 index 0000000..7130619 --- /dev/null +++ b/src/bench/bench.c @@ -0,0 +1,20 @@ +#include +#include + +#ifdef USE_BENCH + +inline void ff_bench_print(ff_ctx* ctx, const ff_bench *b) +{ + double total_ms = (double)(b->_end - b->_start) * 1000.0 / CLOCKS_PER_SEC; + + ff_dprintf(ctx, "== bench: %s ==\n", b->label); + + for (int i = 0; i < b->_mcount; i++) { + double ms = (double)(b->markers[i].tick - b->_start) * 1000.0 / CLOCKS_PER_SEC; + ff_dprintf(ctx, " [%s] +%f ms\n", b->markers[i].label, ms); + } + + ff_dprintf(ctx, "total: %f ms\n", total_ms); +} + +#endif \ No newline at end of file -- cgit v1.2.3