MCPcopy Create free account
hub / github.com/Kitware/VTK / RunBenchmark

Function RunBenchmark

Examples/ImageProcessing/Cxx/ImageBenchmark.cxx:1182–1363  ·  view source on GitHub ↗

Run a benchmark on the named filter

Source from the content-addressed store, hash-verified

1180
1181// Run a benchmark on the named filter
1182static bool RunBenchmark(const std::string& filterName, const std::string& sourceName,
1183 const int size[3], int scalarType, const std::string& splitMode, bool useSMP,
1184 vtkIdType bytesPerPiece, int minPieceSize[3], int clearCacheSize, std::vector<int>& threads,
1185 int runs, const std::string& units, bool reportFilter, const std::string& outputFile, bool slave)
1186{
1187 vtkSmartPointer<vtkThreadedImageAlgorithm> filter;
1188 filter.TakeReference(CreateFilter(filterName, size));
1189 if (!filter.GetPointer())
1190 {
1191 return false;
1192 }
1193
1194 vtkSmartPointer<vtkImageData> data;
1195 data.TakeReference(CreateData(sourceName, scalarType, size));
1196 if (!data.GetPointer())
1197 {
1198 return false;
1199 }
1200
1201 if (splitMode == "slab")
1202 {
1203 filter->SetSplitModeToSlab();
1204 }
1205 else if (splitMode == "beam")
1206 {
1207 filter->SetSplitModeToBeam();
1208 }
1209 else if (splitMode == "block")
1210 {
1211 filter->SetSplitModeToBlock();
1212 }
1213
1214 filter->SetEnableSMP(useSMP);
1215 if (useSMP)
1216 {
1217 if (bytesPerPiece)
1218 {
1219 filter->SetDesiredBytesPerPiece(bytesPerPiece);
1220 }
1221 if (minPieceSize[0] > 0 && minPieceSize[1] > 0 && minPieceSize[2] > 0)
1222 {
1223 filter->SetMinimumPieceSize(minPieceSize);
1224 }
1225 }
1226 else
1227 {
1228 if (!threads.empty())
1229 {
1230 filter->SetNumberOfThreads(threads[0]);
1231 }
1232 }
1233
1234 filter->SetInputData(data);
1235
1236 if (Verbose)
1237 {
1238 PrintInfo(filter, std::cout);
1239 }

Callers 1

IMAGE_BENCHMARK_MAINFunction · 0.70

Calls 15

CreateFilterFunction · 0.85
PrintInfoFunction · 0.85
ClearCPUCacheFunction · 0.85
SetShiftMethod · 0.80
CreateDataFunction · 0.70
NewFunction · 0.50
sqrtFunction · 0.50
TakeReferenceMethod · 0.45
GetPointerMethod · 0.45
emptyMethod · 0.45
SetNumberOfThreadsMethod · 0.45
SetInputDataMethod · 0.45

Tested by

no test coverage detected