vigra - Timing macros for runtime measurements

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

Timing macros for runtime measurements |

#include <vigra/timing.hxx>

These macros allow to perform execution speed measurements. Results are reported in milliseconds. However, note that timings below 1 msec are generally subject to round-off errors. Under LINUX, you can #define VIGRA_HIRES_TIMING to get better accuracy, but this requires linking against librt.

Basic usage:

void time_it()
{
USETICTOC
TIC
... code to be timed
TOC
... untimed code
TIC
... other code to be timed
TOC
}

Instead of TOC, which outputs the time difference to std::cerr, you may use TOCN (the time difference in msec as a double) or TOCS (the time difference as a std::string).

Alternatively, you can perform nested timing like so:

void time_it()
{
USE_NESTED_TICTOC
TICPUSH
... code to be timed
TICPUSH
... nested code to be timed
TOC print time for nested code
... more code to be timed
TOC print total time
}

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.1 (Fri May 19 2017)