Link Search Menu Expand Document

Measuring Time

To measure the time between two operations:

double t1 = tic();
// your operations
double t2 = toc();

To measure the time it takes to run a function:

double t = timeit([](){
    // Your function...
});

To create a mini-benchmark measuring the time it takes to run a function:

std::vector<double> t = minibench([](){
    // Your function...
});
std::cout << "Mean: " << mean(t) << std::endl;
std::cout << "Standard Deviation: " << stddev(t) << std::endl;