ts(perf): initialize ThreadPool
authorAlexander Alekhin <alexander.alekhin@intel.com>
Mon, 31 Jul 2017 13:22:06 +0000 (16:22 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Mon, 31 Jul 2017 13:51:08 +0000 (16:51 +0300)
modules/ts/src/ts_perf.cpp

index a09ba1a..7fbf2c7 100644 (file)
@@ -1212,6 +1212,18 @@ int64 TestBase::_calibrate()
         }
     };
 
+    // Initialize ThreadPool
+    class _dummyParallel : public ParallelLoopBody
+    {
+    public:
+       void operator()(const cv::Range& range) const
+       {
+           // nothing
+           CV_UNUSED(range);
+       }
+    };
+    parallel_for_(cv::Range(0, 1000), _dummyParallel());
+
     _timeadjustment = 0;
     _helper h;
     h.PerfTestBody();
@@ -1838,6 +1850,8 @@ void TestBase::SetUp()
 
     if (param_threads >= 0)
         cv::setNumThreads(param_threads);
+    else
+        cv::setNumThreads(-1);
 
 #ifdef __ANDROID__
     if (param_affinity_mask)