| 83 | }; |
| 84 | |
| 85 | int main(int argc, char* argv[]) |
| 86 | { |
| 87 | // Create the path to the ImageBenchmark executable (assume that |
| 88 | // it is in same directory) |
| 89 | std::string exename = argv[0]; |
| 90 | size_t l = 0; |
| 91 | for (size_t j = 0; j != exename.length(); j++) |
| 92 | { |
| 93 | if (exename[j] == '/' || exename[j] == '\\') |
| 94 | { |
| 95 | l = j + 1; |
| 96 | } |
| 97 | } |
| 98 | exename = exename.substr(0, l) + "ImageBenchmark"; |
| 99 | |
| 100 | // Go through the arguments to create args for ImageBenchmark |
| 101 | bool useSMP = vtkThreadedImageAlgorithm::GetGlobalDefaultEnableSMP(); |
| 102 | std::string prefix; |
| 103 | std::vector<const char*> args; |
| 104 | args.push_back(exename.c_str()); |
| 105 | int argi = 1; |
| 106 | while (argi < argc) |
| 107 | { |
| 108 | std::string arg = argv[argi]; |
| 109 | if (arg == "-h" || arg == "-help" || arg == "--help") |
| 110 | { |
| 111 | std::cout << HelpText; |
| 112 | for (BenchParameter* p = Parameters; p->Parameter; p++) |
| 113 | { |
| 114 | std::string opt = p->Parameter; |
| 115 | for (BenchOption* o = p->Options; o->Option; o++) |
| 116 | { |
| 117 | std::cout << " " << opt << " " << o->Option << " (" << o->Name << ")\n"; |
| 118 | } |
| 119 | std::cout << std::endl; |
| 120 | } |
| 121 | return 0; |
| 122 | } |
| 123 | else if (arg == "--version") |
| 124 | { |
| 125 | std::cout << "ImageBenchmarkDriver " << vtkVersion::GetVTKVersion() << "\n"; |
| 126 | return 0; |
| 127 | } |
| 128 | else if (arg == "--prefix") |
| 129 | { |
| 130 | if (++argi < argc) |
| 131 | { |
| 132 | prefix = argv[argi++]; |
| 133 | } |
| 134 | } |
| 135 | else if (arg == "--enable-smp") |
| 136 | { |
| 137 | args.push_back(argv[argi++]); |
| 138 | if (argi < argc) |
| 139 | { |
| 140 | std::string s = argv[argi]; |
| 141 | if (s == "on" || s == "yes" || s == "true") |
| 142 | { |