Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 415 Bytes

timing_function.md

File metadata and controls

16 lines (11 loc) · 415 Bytes

Measuring the time a function call takes

Use the std::chrono library to measure the time between two points in code.

#include <chrono>
using namespace std::chrono;

auto start = std::chrono::steady_clock::now();

//  test code here

auto stop = std::chrono::steady_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cerr << "Analytics frame time: " << duration.count() << endl;