diff options
author | Meng Mengmeng <mengmeng.meng@intel.com> | 2015-11-20 06:25:34 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2015-11-25 11:58:55 +0800 |
commit | d4d20820bd41a88a1a0abe7c32ee11c1328f2c1c (patch) | |
tree | 682f7556dead9dce9240a13dff632a8ac30ad56c /utests/utest.hpp | |
parent | 3bda30a2d5705fea64568bd4f39367754364bc8d (diff) | |
download | beignet-d4d20820bd41a88a1a0abe7c32ee11c1328f2c1c.tar.gz |
Add a option which could set the benchmark unit properly.
For benchmarks, the units are varied e.g. GB/S, FPS, score and so on.
So we need to make a choice for every benchmark.
Signed-off-by: Meng Mengmeng <mengmeng.meng@intel.com>
Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'utests/utest.hpp')
-rw-r--r-- | utests/utest.hpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/utests/utest.hpp b/utests/utest.hpp index cda75459..6ecbaf79 100644 --- a/utests/utest.hpp +++ b/utests/utest.hpp @@ -101,12 +101,12 @@ struct UTest static const UTest __##FN##__(__ANON__##FN##__, #FN, true); /*! Turn a function into a unit performance test */ -#define MAKE_BENCHMARK_FROM_FUNCTION_KEEP_PROGRAM(FN, KEEP_PROGRAM) \ - static void __ANON__##FN##__(void) { BENCHMARK(FN()); } \ +#define MAKE_BENCHMARK_FROM_FUNCTION_KEEP_PROGRAM(FN, KEEP_PROGRAM, ...) \ + static void __ANON__##FN##__(void) { BENCHMARK(FN(), __VA_ARGS__); } \ static const UTest __##FN##__(__ANON__##FN##__, #FN, true, false, !(KEEP_PROGRAM)); -#define MAKE_BENCHMARK_FROM_FUNCTION(FN) \ - static void __ANON__##FN##__(void) { BENCHMARK(FN()); } \ +#define MAKE_BENCHMARK_FROM_FUNCTION(FN, ...) \ + static void __ANON__##FN##__(void) { BENCHMARK(FN(), __VA_ARGS__); } \ static const UTest __##FN##__(__ANON__##FN##__, #FN, true); @@ -138,12 +138,12 @@ struct UTest } \ } while (0) -#define BENCHMARK(EXPR) \ +#define BENCHMARK(EXPR, ...) \ do { \ double ret = 0;\ try { \ ret = EXPR; \ - std::cout << " [Result: " << std::fixed<< std::setprecision(3) << ret << " GB/S] [SUCCESS]" << std::endl; \ + std::cout << " [Result: " << std::fixed<< std::setprecision(3) << ret << " " << __VA_ARGS__ << "] [SUCCESS]" << std::endl; \ UTest::retStatistics.passCount += 1; \ } \ catch (Exception e) { \ |