[ 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
}
TIC
#define TIC
Definition timing.hxx:321
USETICTOC
#define USETICTOC
Definition timing.hxx:320
TOC
#define TOC
Definition timing.hxx:322

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
}
USE_NESTED_TICTOC
#define USE_NESTED_TICTOC
Definition timing.hxx:325
TICPUSH
#define TICPUSH
Definition timing.hxx:326

© 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.12.2