#include <iomanip>\r
#include <stdexcept>\r
+#include <string>\r
#include "performance.h"\r
\r
using namespace std;\r
\r
int main(int argc, char** argv)\r
{\r
- if (argc < 3)\r
- cout << "Usage: performance_gpu <test_filter> <working_dir_with_slash>\n\n";\r
- if (argc >= 2)\r
- TestSystem::instance().setTestFilter(argv[1]);\r
- if (argc >= 3)\r
- TestSystem::instance().setWorkingDir(argv[2]);\r
+ // Parse command line arguments\r
+ for (int i = 1; i < argc; ++i)\r
+ {\r
+ string key = argv[i];\r
+ if (key == "--help")\r
+ {\r
+ cout << "Usage: performance_gpu [--filter <test_filter>] [--working-dir <working_dir_with_slash>]\n";\r
+ return 0;\r
+ }\r
+ if (key == "--filter" && i + 1 < argc)\r
+ TestSystem::instance().setTestFilter(argv[++i]);\r
+ else if (key == "--working-dir" && i + 1 < argc)\r
+ TestSystem::instance().setWorkingDir(argv[++i]);\r
+ else \r
+ {\r
+ cout << "Unknown parameter: '" << key << "'" << endl;\r
+ return -1;\r
+ }\r
+ }\r
\r
redirectError(cvErrorCallback);\r
TestSystem::instance().run();\r