Changed the impls argument to be an array name.
Turns out, you can't use preprocessor directives inside macro arguments. Who'd have thought?
This commit is contained in:
parent
51a672ec40
commit
3ea4836a0a
@ -44,8 +44,11 @@
|
|||||||
|
|
||||||
using namespace perf;
|
using namespace perf;
|
||||||
|
|
||||||
CV_PERF_TEST_MAIN_WITH_IMPLS(gpu, (
|
static const char * impls[] = {
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
"cuda",
|
"cuda",
|
||||||
#endif
|
#endif
|
||||||
"plain"), printCudaInfo())
|
"plain"
|
||||||
|
};
|
||||||
|
|
||||||
|
CV_PERF_TEST_MAIN_WITH_IMPLS(gpu, impls, printCudaInfo())
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include "perf_precomp.hpp"
|
#include "perf_precomp.hpp"
|
||||||
#include "opencv2/ts/gpu_perf.hpp"
|
#include "opencv2/ts/gpu_perf.hpp"
|
||||||
|
|
||||||
CV_PERF_TEST_MAIN_WITH_IMPLS(nonfree, (
|
static const char * impls[] = {
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
"cuda",
|
"cuda",
|
||||||
#endif
|
#endif
|
||||||
"plain"), perf::printCudaInfo())
|
"plain"
|
||||||
|
};
|
||||||
|
|
||||||
|
CV_PERF_TEST_MAIN_WITH_IMPLS(nonfree, impls, perf::printCudaInfo())
|
||||||
|
@ -44,8 +44,11 @@
|
|||||||
|
|
||||||
using namespace perf;
|
using namespace perf;
|
||||||
|
|
||||||
CV_PERF_TEST_MAIN_WITH_IMPLS(superres, (
|
static const char * impls[] = {
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
"cuda",
|
"cuda",
|
||||||
#endif
|
#endif
|
||||||
"plain"), printCudaInfo())
|
"plain"
|
||||||
|
};
|
||||||
|
|
||||||
|
CV_PERF_TEST_MAIN_WITH_IMPLS(superres, impls, printCudaInfo())
|
||||||
|
@ -475,25 +475,31 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
|
|||||||
INSTANTIATE_TEST_CASE_P(/*none*/, fixture##_##name, params);\
|
INSTANTIATE_TEST_CASE_P(/*none*/, fixture##_##name, params);\
|
||||||
void fixture##_##name::PerfTestBody()
|
void fixture##_##name::PerfTestBody()
|
||||||
|
|
||||||
#define CV_PERF_UNWRAP_IMPLS(...) __VA_ARGS__
|
|
||||||
|
|
||||||
// "plain" should always be one of the implementations
|
#define CV_PERF_TEST_MAIN_INTERNALS(modulename, impls, ...) \
|
||||||
#define CV_PERF_TEST_MAIN_WITH_IMPLS(modulename, impls, ...) \
|
|
||||||
int main(int argc, char **argv)\
|
|
||||||
{\
|
|
||||||
while (++argc >= (--argc,-1)) {__VA_ARGS__; break;} /*this ugly construction is needed for VS 2005*/\
|
while (++argc >= (--argc,-1)) {__VA_ARGS__; break;} /*this ugly construction is needed for VS 2005*/\
|
||||||
std::string impls_[] = { CV_PERF_UNWRAP_IMPLS impls };\
|
|
||||||
::perf::Regression::Init(#modulename);\
|
::perf::Regression::Init(#modulename);\
|
||||||
::perf::TestBase::Init(std::vector<std::string>(impls_, impls_ + sizeof impls_ / sizeof *impls_),\
|
::perf::TestBase::Init(std::vector<std::string>(impls, impls + sizeof impls / sizeof *impls),\
|
||||||
argc, argv);\
|
argc, argv);\
|
||||||
::testing::InitGoogleTest(&argc, argv);\
|
::testing::InitGoogleTest(&argc, argv);\
|
||||||
cvtest::printVersionInfo();\
|
cvtest::printVersionInfo();\
|
||||||
::testing::Test::RecordProperty("cv_module_name", #modulename);\
|
::testing::Test::RecordProperty("cv_module_name", #modulename);\
|
||||||
::perf::TestBase::RecordRunParameters();\
|
::perf::TestBase::RecordRunParameters();\
|
||||||
return RUN_ALL_TESTS();\
|
return RUN_ALL_TESTS();
|
||||||
|
|
||||||
|
// impls must be an array, not a pointer; "plain" should always be one of the implementations
|
||||||
|
#define CV_PERF_TEST_MAIN_WITH_IMPLS(modulename, impls, ...) \
|
||||||
|
int main(int argc, char **argv)\
|
||||||
|
{\
|
||||||
|
CV_PERF_TEST_MAIN_INTERNALS(modulename, impls, __VA_ARGS__)\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CV_PERF_TEST_MAIN(modulename, ...) CV_PERF_TEST_MAIN_WITH_IMPLS(modulename, ("plain"), __VA_ARGS__)
|
#define CV_PERF_TEST_MAIN(modulename, ...) \
|
||||||
|
int main(int argc, char **argv)\
|
||||||
|
{\
|
||||||
|
const char * plain_only[] = { "plain" };\
|
||||||
|
CV_PERF_TEST_MAIN_INTERNALS(modulename, plain_only, __VA_ARGS__)\
|
||||||
|
}
|
||||||
|
|
||||||
#define TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); stopTimer())
|
#define TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); stopTimer())
|
||||||
#define TEST_CYCLE() for(; startTimer(), next(); stopTimer())
|
#define TEST_CYCLE() for(; startTimer(), next(); stopTimer())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user