Request for changes-120: Replacing itk::TimeProbe

From OTBWiki
Jump to: navigation, search

Status

  • Author: Laurențiu Nicola
  • Additional Contributors (if different than authors)
  • Submitted on 26.10.2017
  • Proposed target release 6.4
  • Adopted : +4 from Victor, Rémi, Julien, Guillaume
  • Merged : 5f7a9eb1757a530ffdab992f54dfc3b26240a281

Summary

Basically, the itk::TimeProbe instance in GDALImageIO sometimes shows up in the profiles. Here is a summary of the changes:

  • The first commit adds an otb::Stopwatch class which uses std::chrono::steady_clock. Its API is heavily inspired from .NET’s Stopwatch. It doesn’t have itk::TimeProbe’s feature of keeping a sample list and doesn’t compute the mean time and iteration count.
  • The second commit replaces TimeProbe with Stopwatch, the changes are mostly mechanical, with a couple of exceptions:
    • Some places used GetMean instead of GetTotal even if the TimeProbe was only started once
    • The stopwatch doesn’t have to be stopped to get the elapsed time, but I left in Stop() calls in some places to avoid compiler warnings under Release configurations
    • Most of the changed code is in otbMsgDevMacro calls or in test applications
    • I changed the unit in a couple of places, e.g. GDALImageIO::{Read,Write} printed seconds, while milliseconds are probably more appropriate for those operations
    • I changed the value from the average to the total in a couple of places, e.g. OGRIOHelper::ConvertOGRLayerToDataTreeNode which displayed the total number of features and the average time and now shows the total time
    • Some operations stopped and restarted the timer, but I made it wrap the whole processing, e.g. OGRIOHelper::ConvertOGRLayerToDataTreeNode or otbLabelObjectMapVectorizer.cxx
    • I made a couple of indentation fixes / changes where it was misleading

Compile tested under RelWithDebInfo.

Note on the API: in classes otb::FilterWatcherBase and otb::WriterWatcherBase, the function GetTimeProbe() has been replaced by GetStopwatch(). However, these functions are never called inside OTB.

Rationale

https://groups.google.com/d/msg/otb-developers/IvsFzSgRojo/0sMeEIZgCQAJ


Implementation details

Classes and files

M       Examples/Classification/ClassificationMapRegularizationExample.cxx
M       Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx
M       Modules/Applications/AppClassification/app/otbTrainRegression.cxx
M       Modules/Applications/AppImageUtils/app/otbConvert.cxx
M       Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx
M       Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx
M       Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx
M       Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx
M       Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx
M       Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx
M       Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx
M       Modules/Core/Common/include/otbFilterWatcherBase.h
A       Modules/Core/Common/include/otbStopwatch.h
M       Modules/Core/Common/include/otbWriterWatcherBase.h
M       Modules/Core/Common/src/CMakeLists.txt
M       Modules/Core/Common/src/otbFilterWatcherBase.cxx
M       Modules/Core/Common/src/otbStandardFilterWatcher.cxx
M       Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx
M       Modules/Core/Common/src/otbStandardWriterWatcher.cxx
A       Modules/Core/Common/src/otbStopwatch.cxx
M       Modules/Core/Common/src/otbWriterWatcherBase.cxx
M       Modules/Core/Common/test/CMakeLists.txt
M       Modules/Core/Common/test/otbCommonTestDriver.cxx
M       Modules/Core/ImageBase/test/otbMultiChannelExtractROI.cxx
M       Modules/Core/LabelMap/test/otbLabelObjectMapVectorizer.cxx
M       Modules/Filtering/Convolution/test/otbCompareOverlapSaveAndClassicalConvolutionWithGaborFilter.cxx
M       Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.txx
M       Modules/Filtering/Projection/include/otbVectorDataTransformFilter.txx
M       Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.txx
M       Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.txx
M       Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.txx
M       Modules/Fusion/MajorityVoting/test/otbNeighborhoodMajorityVotingImageFilterTest.cxx
M       Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
M       Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx
M       Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx
M       Modules/IO/IOKML/src/otbKMLVectorDataIO.cxx
M       Modules/IO/IOTileMap/src/otbTileMapImageIO.cxx
M       Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx
M       Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx
M       Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx
M       Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h
M       Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx
M       Modules/Registration/DisparityMap/test/otbFineRegistrationImageFilterTest.cxx
M       Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.txx
M       Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.txx
M       Modules/Segmentation/Conversion/test/otbVectorDataToLabelMapFilter.cxx
M       Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
M       Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx

Applications

Tests

A       Modules/Core/Common/test/otbStopwatchTest.cxx

Documentation

Additional notes