.TH "timer" 3 "Tue Sep 9 2014" "Version 1.0.10" "MLPACK" \" -*- nroff -*- .ad l .nh .SH NAME timer \- MLPACK Timers .SH "Introduction" .PP 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 \fBmlpack::CLI\fP object, when --verbose is given: .PP .PP .nf $ allknn -r dataset\&.csv -n neighbors_out\&.csv -d distances_out\&.csv -k 5 -v <\&.\&.\&.> [INFO ] Program timers: [INFO ] computing_neighbors: 0\&.010650s [INFO ] loading_data: 0\&.002567s [INFO ] saving_data: 0\&.001115s [INFO ] total_time: 0\&.149816s [INFO ] tree_building: 0\&.000534s .fi .PP .SH "Timer API" .PP The \fBmlpack::Timer\fP class provides three simple methods: .PP .PP .nf void Timer::Start(const char* name); void Timer::Stop(const char* name); timeval Timer::Get(const char* name); .fi .PP .PP Each timer is given a name, and is referenced by that name\&. You can call \fCTimer::Start()\fP and \fCTimer::Stop()\fP multiple times for a particular timer name, and the result will be the sum of the runs of the timer\&. Note that \fCTimer::Stop()\fP must be called before \fCTimer::Start()\fP is called again\&. .PP A 'total_time' timer is run by default for each MLPACK program\&. .SH "Timer Example" .PP Below is a very simple example of timer usage in code\&. .PP .PP .nf #include using namespace mlpack; int main(int argc, char** argv) { CLI::ParseCommandLine(argc, argv); // Start a timer\&. Timer::Start("some_timer"); // Do some things\&. DoSomeStuff(); // Stop the timer\&. Timer::Stop("some_timer"); } .fi .PP .PP If the --verbose flag was given to this executable, the resultant time that 'some_timer' ran for would be shown\&.