summaryrefslogtreecommitdiff
path: root/include/tinyff
diff options
context:
space:
mode:
Diffstat (limited to 'include/tinyff')
-rw-r--r--include/tinyff/common.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/tinyff/common.h b/include/tinyff/common.h
index 370fc8e..34209e8 100644
--- a/include/tinyff/common.h
+++ b/include/tinyff/common.h
@@ -10,7 +10,31 @@
#ifdef USE_BENCH
-#include <tinyff/bench.h>
+#include <bench.h>
+
+#define FF_BENCH_MARK(ctx, label) \
+ do { \
+ if (ctx) \
+ ff_bench_mark(&(ctx)->bench, (label)); \
+ } while (0)
+
+#define FF_BENCH_START(ctx, label) \
+ do { \
+ if (ctx) \
+ ff_bench_start(&(ctx)->bench, (label)); \
+ } while (0)
+
+#define FF_BENCH_END(ctx) \
+ do { \
+ if (ctx) \
+ ff_bench_end(&(ctx)->bench); \
+ } while (0)
+
+#else
+
+#define FF_BENCH_MARK(ctx, label) do {} while (0)
+#define FF_BENCH_START(ctx, label) do {} while (0)
+#define FF_BENCH_END(ctx) do {} while (0)
#endif
@@ -76,7 +100,7 @@ typedef struct {
void* (*ff_calloc)(size_t count, size_t size);
} ff_allocator;
-typedef struct {
+typedef struct ff_ctx {
// Debug settings
ff_stream ff_debug_stream;
ff_flag ff_debug_enabled;