summaryrefslogtreecommitdiff
path: root/source/test/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'source/test/unittests')
-rw-r--r--source/test/unittests/foo.bench.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/test/unittests/foo.bench.c b/source/test/unittests/foo.bench.c
index a3d5c18..ac1e0b5 100644
--- a/source/test/unittests/foo.bench.c
+++ b/source/test/unittests/foo.bench.c
@@ -1,4 +1,4 @@
-#define KIT_BENCH_FILE foo
+#define KIT_TEST_FILE foo
#include "../../kit_test/bench.h"
struct test_foo_ {
@@ -6,8 +6,15 @@ struct test_foo_ {
};
BENCHMARK("foo") {
+
+ /* Benchmark setup.
+ */
+
BENCHMARK_BEGIN;
{
+ /* Measured code snippet.
+ */
+
int x = 0;
struct test_foo_ f = { 0. };
@@ -16,10 +23,19 @@ BENCHMARK("foo") {
x ^= i;
f.f += 0.1;
}
+
DO_NOT_OPTIMIZE(x);
DO_NOT_OPTIMIZE(f);
}
BENCHMARK_END;
}
-BENCHMARK("bar") { }
+BENCHMARK("bar") {
+ BENCHMARK_REPEAT(10);
+ BENCHMARK_REPEAT(100);
+
+ BENCHMARK_BEGIN;
+ BENCHMARK_END;
+}
+
+BENCHMARK("empty") { }