[C++] Measure of time elapsed

#include <ctime>
using namespace std;

clock_t begin = clock();
target_func();
clock_t end = clock();
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
cout << "Elapsed time: " << elapsed_secs << " sec." << endl;

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *