c++ time a function code example
Example 1: time function c++
#include <chrono>
using namespace std::chrono;
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout << duration.count() << endl;
Example 2: time function c++
#include <chrono>
using namespace std::chrono;
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
cout << duration_cast<microseconds>(stop - start).count() << endl;