summaryrefslogtreecommitdiff
path: root/bench/bench.h
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-05-22 09:43:59 +1000
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-05-22 09:43:59 +1000
commit77aa9a3259ddfd6c64534d63424d5b0fa3010900 (patch)
tree3744ec77c3cbe164457d1e421fd4bf7dceff4c02 /bench/bench.h
parent4d42b317f4970bd08f9b81fcc184fc015736ff58 (diff)
refactor: move benches to include directory
Diffstat (limited to 'bench/bench.h')
-rw-r--r--bench/bench.h57
1 files changed, 0 insertions, 57 deletions
diff --git a/bench/bench.h b/bench/bench.h
deleted file mode 100644
index fc226d9..0000000
--- a/bench/bench.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef TINYFF_BENCH_H_
-#define TINYFF_BENCH_H_
-
-#include <time.h>
-#include <tinyff/result.h>
-
-#define FF_BENCH_MAX_MARKERS 32
-
-typedef struct ff_ctx ff_ctx;
-
-typedef struct {
- const char *label;
- clock_t tick;
-} ff_bench_marker;
-
-typedef struct {
- const char *label;
- clock_t _start;
- clock_t _end;
-
- ff_bench_marker markers[FF_BENCH_MAX_MARKERS];
- int _mcount;
-} ff_bench;
-
-// These need to be inline so they are fast
-
-static inline void ff_bench_start(ff_bench *b, const char* label) {
- b->label = label;
- b->_start = clock();
- b->_end = 0;
- b->_mcount = 0;
-
-}
-
-
-static inline void ff_bench_end(ff_bench *b) {
- b->_end = clock();
-}
-
-static inline ff_result ff_bench_mark(ff_bench *b, const char *label) {
- if (b->_mcount >= FF_BENCH_MAX_MARKERS) return FF_RESULT_ERROR_OUT_OF_BOUNDS;
-
- ff_bench_marker m;
- m.label = label;
- m.tick = clock();
-
- b->markers[b->_mcount] = m;
- b->_mcount++;
-
- return FF_RESULT_OK;
-}
-
-static inline double ff_bench_seconds(const ff_bench *b) {
- return (double)(b->_end - b->_start) / CLOCKS_PER_SEC;
-}
-
-#endif // TINYFF_BENCH_H \ No newline at end of file