mlpack provides a simple timer interface for the timing of machine learning methods. The results of any timers used during the program are displayed at output by the mlpack::CLI object, when –verbose is given:
The mlpack::Timer class provides three simple methods:
Each timer is given a name, and is referenced by that name. You can call
Timer::Stop() multiple times for a particular timer name, and the result will be the sum of the runs of the timer. Note that
Timer::Stop() must be called before
Timer::Start() is called again, otherwise a std::runtime_error exception will be thrown.
A "total_time" timer is run by default for each mlpack program.
Below is a very simple example of timer usage in code.
If the –verbose flag was given to this executable, the resultant time that "some_timer" ran for would be shown.
Generated by 1.8.13