diff options
author | Chuanbo Weng <chuanbo.weng@intel.com> | 2015-02-03 10:27:22 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-02-06 12:46:22 +0800 |
commit | 25a6a17a4ec46427ac29a0f0b4ce765c440864c7 (patch) | |
tree | 2a9f902f2509a6f70717f269febc915495f53139 /utests/utest.hpp | |
parent | a1ae5876623858957c3841edf7d0f79bc193ad3a (diff) | |
download | beignet-25a6a17a4ec46427ac29a0f0b4ce765c440864c7.tar.gz |
Refine benchmark output.
Change output measurement from time to bandwidth, so we can compare
all benchmark results easily. And change return type of benchmark
from int to double, because int is not precise enough.
v2: Change output measurement from time to bandwidth.
Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/utest.hpp')
-rw-r--r-- | utests/utest.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utests/utest.hpp b/utests/utest.hpp index b028b64f..7ae8b876 100644 --- a/utests/utest.hpp +++ b/utests/utest.hpp @@ -30,6 +30,7 @@ #include "utest_exception.hpp" #include <vector> #include <iostream> +#include <iomanip> /*! struct for statistics */ struct RStatistics @@ -135,10 +136,10 @@ struct UTest #define BENCHMARK(EXPR) \ do { \ - int ret = 0;\ + double ret = 0;\ try { \ ret = EXPR; \ - std::cout << " [Result: " << ret << "] [SUCCESS]" << std::endl; \ + std::cout << " [Result: " << std::fixed<< std::setprecision(3) << ret << " GB/S] [SUCCESS]" << std::endl; \ UTest::retStatistics.passCount += 1; \ } \ catch (Exception e) { \ @@ -147,5 +148,8 @@ struct UTest UTest::retStatistics.failCount++; \ } \ } while (0) + +#define BANDWIDTH(BYTES, MSEC) \ + ((double)(BYTES)) / ((MSEC) * 1e6); #endif /* __UTEST_UTEST_HPP__ */ |