\r
using namespace perf;\r
\r
+int64 TestBase::timeLimitDefault = 0;\r
+unsigned int TestBase::iterationsLimitDefault = (unsigned int)(-1);\r
+int64 TestBase::_timeadjustment = 0;\r
+\r
+const char *command_line_keys =\r
+{\r
+ "{ |perf_max_outliers |8 |percent of allowed outliers}"\r
+ "{ |perf_min_samples |10 |minimal required numer of samples}"\r
+ "{ |perf_force_samples |100 |force set maximum number of samples for all tests}"\r
+ "{ |perf_seed |809564 |seed for random numbers generator}"\r
+ "{ |perf_tbb_nthreads |-1 |if TBB is enabled, the number of TBB threads}"\r
+ "{ |perf_write_sanity |false |allow to create new records for sanity checks}"\r
+ #if ANDROID\r
+ "{ |perf_time_limit |6.0 |default time limit for a single test (in seconds)}"\r
+ "{ |perf_affinity_mask |0 |set affinity mask for the main thread}"\r
+ #else\r
+ "{ |perf_time_limit |3.0 |default time limit for a single test (in seconds)}"\r
+ #endif\r
+ "{ |perf_max_deviation |1.0 |}"\r
+ "{h |help |false |}"\r
+};\r
+\r
+static double param_max_outliers;\r
+static double param_max_deviation;\r
+static unsigned int param_min_samples;\r
+static unsigned int param_force_samples;\r
+static uint64 param_seed;\r
+static double param_time_limit;\r
+static int param_tbb_nthreads;\r
+static bool param_write_sanity;\r
+#if ANDROID\r
+static int param_affinity_mask;\r
+\r
+#include <sys/syscall.h>\r
+#include <pthread.h>\r
+static void setCurrentThreadAffinityMask(int mask)\r
+{\r
+ pid_t pid=gettid();\r
+ int syscallres=syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask);\r
+ if (syscallres)\r
+ {\r
+ int err=errno;\r
+ err=err;//to avoid warnings about unused variables\r
+ LOGE("Error in the syscall setaffinity: mask=%d=0x%x err=%d=0x%x", mask, mask, err, err);\r
+ }\r
+}\r
+\r
+#endif\r
+\r
void randu(cv::Mat& m)\r
{\r
const int bigValue = 0x00000FFF;\r
storageOutPath = testSuitName;\r
}\r
\r
- if (storageIn.open(storageInPath, cv::FileStorage::READ))\r
+ try\r
{\r
- rootIn = storageIn.root();\r
- if (storageInPath.length() > 3 && storageInPath.substr(storageInPath.length()-3) == ".gz")\r
- storageOutPath += "_new";\r
- storageOutPath += ext;\r
+ if (storageIn.open(storageInPath, cv::FileStorage::READ))\r
+ {\r
+ rootIn = storageIn.root();\r
+ if (storageInPath.length() > 3 && storageInPath.substr(storageInPath.length()-3) == ".gz")\r
+ storageOutPath += "_new";\r
+ storageOutPath += ext;\r
+ }\r
}\r
- else\r
+ catch(cv::Exception& ex)\r
+ {\r
+ LOGE("Failed to open sanity data for reading: %s", storageInPath.c_str());\r
+ }\r
+ \r
+ if(!storageIn.isOpened())\r
storageOutPath = storageInPath;\r
}\r
\r
cv::FileNode n = rootIn[nodename];\r
if(n.isNone())\r
{\r
- if (nodename != currentTestNodeName)\r
+ if(param_write_sanity)\r
{\r
- if (!currentTestNodeName.empty())\r
- write() << "}";\r
- currentTestNodeName = nodename;\r
+ if (nodename != currentTestNodeName)\r
+ {\r
+ if (!currentTestNodeName.empty())\r
+ write() << "}";\r
+ currentTestNodeName = nodename;\r
\r
- write() << nodename << "{";\r
+ write() << nodename << "{";\r
+ }\r
+ write() << name << "{";\r
+ write(array);\r
+ write() << "}";\r
}\r
- write() << name << "{";\r
- write(array);\r
- write() << "}";\r
}\r
else\r
{\r
/*****************************************************************************************\\r
* ::perf::TestBase\r
\*****************************************************************************************/\r
-int64 TestBase::timeLimitDefault = 0;\r
-unsigned int TestBase::iterationsLimitDefault = (unsigned int)(-1);\r
-int64 TestBase::_timeadjustment = 0;\r
-\r
-const char *command_line_keys =\r
-{\r
- "{ |perf_max_outliers |8 |percent of allowed outliers}"\r
- "{ |perf_min_samples |10 |minimal required numer of samples}"\r
- "{ |perf_force_samples |100 |force set maximum number of samples for all tests}"\r
- "{ |perf_seed |809564 |seed for random numbers generator}"\r
- "{ |perf_tbb_nthreads |-1 |if TBB is enabled, the number of TBB threads}"\r
- #if ANDROID\r
- "{ |perf_time_limit |6.0 |default time limit for a single test (in seconds)}"\r
- "{ |perf_affinity_mask |0 |set affinity mask for the main thread}"\r
- #else\r
- "{ |perf_time_limit |3.0 |default time limit for a single test (in seconds)}"\r
- #endif\r
- "{ |perf_max_deviation |1.0 |}"\r
- "{h |help |false |}"\r
-};\r
-\r
-double param_max_outliers;\r
-double param_max_deviation;\r
-unsigned int param_min_samples;\r
-unsigned int perf_force_samples;\r
-uint64 param_seed;\r
-double param_time_limit;\r
-int param_tbb_nthreads;\r
-#if ANDROID\r
-int param_affinity_mask;\r
-\r
-#include <sys/syscall.h>\r
-#include <pthread.h>\r
-static void setCurrentThreadAffinityMask(int mask)\r
-{\r
- pid_t pid=gettid();\r
- int syscallres=syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask);\r
- if (syscallres)\r
- {\r
- int err=errno;\r
- err=err;//to avoid warnings about unused variables\r
- LOGE("Error in the syscall setaffinity: mask=%d=0x%x err=%d=0x%x", mask, mask, err, err);\r
- }\r
-}\r
-\r
-#endif\r
-\r
void TestBase::Init(int argc, const char* const argv[])\r
{\r
cv::CommandLineParser args(argc, argv, command_line_keys);\r
param_max_deviation = std::max(0., args.get<double>("perf_max_deviation"));\r
param_seed = args.get<uint64>("perf_seed");\r
param_time_limit = std::max(0., args.get<double>("perf_time_limit"));\r
- perf_force_samples = args.get<unsigned int>("perf_force_samples");\r
+ param_force_samples = args.get<unsigned int>("perf_force_samples");\r
+ param_write_sanity = args.get<bool>("perf_write_sanity");\r
\r
param_tbb_nthreads = args.get<int>("perf_tbb_nthreads");\r
#if ANDROID\r
}\r
\r
timeLimitDefault = param_time_limit == 0.0 ? 1 : (int64)(param_time_limit * cv::getTickFrequency());\r
- iterationsLimitDefault = perf_force_samples == 0 ? (unsigned)(-1) : perf_force_samples;\r
+ iterationsLimitDefault = param_force_samples == 0 ? (unsigned)(-1) : param_force_samples;\r
_timeadjustment = _calibrate();\r
}\r
\r