summaryrefslogtreecommitdiff
path: root/src/bench/bench.c
blob: 7130619014ffc3ad40e2f3665a39b158583051fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <tinyff/bench/bench.h>
#include <tinyff/common.h>

#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