From a567c03fdfc8ddfd5f760e32930ff84b4b25cae4 Mon Sep 17 00:00:00 2001 From: Anna Kogan Date: Wed, 6 Feb 2013 14:53:33 +0400 Subject: [PATCH 1/2] Switched to TEST_CYCLE_MULTIRUN for fast tests --- modules/core/perf/perf_compare.cpp | 3 ++- modules/core/perf/perf_convertTo.cpp | 4 ++-- modules/core/perf/perf_mat.cpp | 6 ++++-- modules/core/perf/perf_merge.cpp | 3 ++- modules/core/perf/perf_split.cpp | 4 ++-- modules/core/perf/perf_stat.cpp | 3 ++- modules/imgproc/perf/perf_cvt_color.cpp | 4 ++-- modules/imgproc/perf/perf_threshold.cpp | 4 ++-- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/core/perf/perf_compare.cpp b/modules/core/perf/perf_compare.cpp index 32f8ba7682..5fb755d956 100644 --- a/modules/core/perf/perf_compare.cpp +++ b/modules/core/perf/perf_compare.cpp @@ -52,7 +52,8 @@ PERF_TEST_P( Size_MatType_CmpType, compareScalar, declare.in(src1, src2, WARMUP_RNG).out(dst); - TEST_CYCLE() cv::compare(src1, src2, dst, cmpType); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) cv::compare(src1, src2, dst, cmpType); SANITY_CHECK(dst); } diff --git a/modules/core/perf/perf_convertTo.cpp b/modules/core/perf/perf_convertTo.cpp index c4e832f1f7..8007361228 100644 --- a/modules/core/perf/perf_convertTo.cpp +++ b/modules/core/perf/perf_convertTo.cpp @@ -29,9 +29,9 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo, Mat src(sz, CV_MAKETYPE(depthSrc, channels)); randu(src, 0, 255); Mat dst(sz, CV_MAKETYPE(depthDst, channels)); - declare.iterations(500); - TEST_CYCLE() src.convertTo(dst, depthDst, alpha); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) src.convertTo(dst, depthDst, alpha); SANITY_CHECK(dst, alpha == 1.0 ? 1e-12 : 1e-7); } diff --git a/modules/core/perf/perf_mat.cpp b/modules/core/perf/perf_mat.cpp index 3749feb384..79a3ecd1ff 100644 --- a/modules/core/perf/perf_mat.cpp +++ b/modules/core/perf/perf_mat.cpp @@ -18,7 +18,8 @@ PERF_TEST_P(Size_MatType, Mat_Eye, declare.out(diagonalMatrix); - TEST_CYCLE() + int runs = (size.width <= 640) ? 15 : 5; + TEST_CYCLE_MULTIRUN(runs) { diagonalMatrix = Mat::eye(size, type); } @@ -38,7 +39,8 @@ PERF_TEST_P(Size_MatType, Mat_Zeros, declare.out(zeroMatrix); - TEST_CYCLE() + int runs = (size.width <= 640) ? 15 : 5; + TEST_CYCLE_MULTIRUN(runs) { zeroMatrix = Mat::zeros(size, type); } diff --git a/modules/core/perf/perf_merge.cpp b/modules/core/perf/perf_merge.cpp index d10cc81542..d82941a92b 100644 --- a/modules/core/perf/perf_merge.cpp +++ b/modules/core/perf/perf_merge.cpp @@ -30,7 +30,8 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge, } Mat dst; - TEST_CYCLE() merge( (vector &)mv, dst ); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) merge( (vector &)mv, dst ); SANITY_CHECK(dst, 1e-12); } \ No newline at end of file diff --git a/modules/core/perf/perf_split.cpp b/modules/core/perf/perf_split.cpp index f5de9b6707..df9095fc61 100644 --- a/modules/core/perf/perf_split.cpp +++ b/modules/core/perf/perf_split.cpp @@ -26,8 +26,8 @@ PERF_TEST_P( Size_Depth_Channels, split, randu(m, 0, 255); vector mv; - - TEST_CYCLE() split(m, (vector&)mv); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) split(m, (vector&)mv); SANITY_CHECK(mv, 1e-12); } diff --git a/modules/core/perf/perf_stat.cpp b/modules/core/perf/perf_stat.cpp index 79e849e081..b7fc43d120 100644 --- a/modules/core/perf/perf_stat.cpp +++ b/modules/core/perf/perf_stat.cpp @@ -97,7 +97,8 @@ PERF_TEST_P(Size_MatType, countNonZero, testing::Combine( testing::Values( TYPIC declare.in(src, WARMUP_RNG); - TEST_CYCLE() cnt = countNonZero(src); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) cnt = countNonZero(src); SANITY_CHECK(cnt); } diff --git a/modules/imgproc/perf/perf_cvt_color.cpp b/modules/imgproc/perf/perf_cvt_color.cpp index 3919539ef5..fd1d0459a8 100644 --- a/modules/imgproc/perf/perf_cvt_color.cpp +++ b/modules/imgproc/perf/perf_cvt_color.cpp @@ -299,10 +299,10 @@ PERF_TEST_P(Size_CvtMode2, cvtColorYUV420, Mat src(sz.height + sz.height / 2, sz.width, CV_8UC(ch.scn)); Mat dst(sz, CV_8UC(ch.dcn)); - declare.time(100); declare.in(src, WARMUP_RNG).out(dst); - TEST_CYCLE() cvtColor(src, dst, mode, ch.dcn); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn); SANITY_CHECK(dst, 1); } diff --git a/modules/imgproc/perf/perf_threshold.cpp b/modules/imgproc/perf/perf_threshold.cpp index dd1602cd20..8727b6339e 100644 --- a/modules/imgproc/perf/perf_threshold.cpp +++ b/modules/imgproc/perf/perf_threshold.cpp @@ -31,9 +31,9 @@ PERF_TEST_P(Size_MatType_ThreshType, threshold, double maxval = theRNG().uniform(1, 254); declare.in(src, WARMUP_RNG).out(dst); - declare.iterations(500); - TEST_CYCLE() threshold(src, dst, thresh, maxval, threshType); + int runs = (sz.width <= 640) ? 8 : 1; + TEST_CYCLE_MULTIRUN(runs) threshold(src, dst, thresh, maxval, threshType); SANITY_CHECK(dst); } From f6e0d327b05dc584b527189147eeef8b29acdeed Mon Sep 17 00:00:00 2001 From: Anna Kogan Date: Wed, 20 Feb 2013 16:59:17 +0400 Subject: [PATCH 2/2] Increased time limits --- modules/imgproc/perf/perf_matchTemplate.cpp | 6 ++++-- modules/video/perf/perf_tvl1optflow.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/imgproc/perf/perf_matchTemplate.cpp b/modules/imgproc/perf/perf_matchTemplate.cpp index 0c727d5a48..a89435b535 100644 --- a/modules/imgproc/perf/perf_matchTemplate.cpp +++ b/modules/imgproc/perf/perf_matchTemplate.cpp @@ -33,7 +33,8 @@ PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateSmall, declare .in(img, WARMUP_RNG) .in(tmpl, WARMUP_RNG) - .out(result); + .out(result) + .time(30); TEST_CYCLE() matchTemplate(img, tmpl, result, method); @@ -66,7 +67,8 @@ PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateBig, declare .in(img, WARMUP_RNG) .in(tmpl, WARMUP_RNG) - .out(result); + .out(result) + .time(30); TEST_CYCLE() matchTemplate(img, tmpl, result, method); diff --git a/modules/video/perf/perf_tvl1optflow.cpp b/modules/video/perf/perf_tvl1optflow.cpp index ad90915128..36f16d9943 100644 --- a/modules/video/perf/perf_tvl1optflow.cpp +++ b/modules/video/perf/perf_tvl1optflow.cpp @@ -13,7 +13,7 @@ pair impair(const char* im1, const char* im2) PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, testing::Values(impair("cv/optflow/RubberWhale1.png", "cv/optflow/RubberWhale2.png"))) { - declare.time(40); + declare.time(260); Mat frame1 = imread(getDataPath(GetParam().first), IMREAD_GRAYSCALE); Mat frame2 = imread(getDataPath(GetParam().second), IMREAD_GRAYSCALE);