aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/Benchmark.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-05-13 11:54:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-13 11:54:00 -0700
commitd0a1088bf747a9291a178cb08e162d2c84a9aa7c (patch)
tree2ed266106341594ac9226ae1f475686175bf3086 /bench/Benchmark.h
parent19e4c02a4112f9a9c63247613c201dbba84110b4 (diff)
Add _aa variants of Xfermode benches.
Also, allow multiple DEF_BENCH() per line by using __COUNTER__ instead of __LINE__. BUG=skia: Review URL: https://codereview.chromium.org/1140643004
Diffstat (limited to 'bench/Benchmark.h')
-rw-r--r--bench/Benchmark.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/bench/Benchmark.h b/bench/Benchmark.h
index 5ba6e91108..22b52ab4e8 100644
--- a/bench/Benchmark.h
+++ b/bench/Benchmark.h
@@ -13,11 +13,10 @@
#include "SkString.h"
#include "SkTRegistry.h"
-#define DEF_BENCH(code) \
-namespace { \
-static Benchmark* SK_MACRO_APPEND_LINE(factory)(void*) { code; } \
-BenchRegistry SK_MACRO_APPEND_LINE(g_R_)(SK_MACRO_APPEND_LINE(factory)); \
-}
+#define DEF_BENCH3(code, N) \
+ static BenchRegistry gBench##N([](void*) -> Benchmark* { code; });
+#define DEF_BENCH2(code, N) DEF_BENCH3(code, N)
+#define DEF_BENCH(code) DEF_BENCH2(code, __COUNTER__)
/*
* With the above macros, you can register benches as follows (at the bottom