chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
domeSomething();
chrono::steady_clock::time_point t2 = chrono::steady_clock::now();
chrono::duration<double> time_used = chrono::duration_cast<chrono::duration<double>>(t2 - t1);
cout<<"solve time cost = "<<time_used.count()<<" secondes."<<endl;
#include <ctime>
using namespace std;
clock_t start = clock();
clock_t end = clock();
cout << "花费了" << (double)(end - start) / CLOCKS_PER_SEC << "秒" << endl;
#include <time.h>
using namespace std;
timeval start, end;
gettimeofday(&start, NULL);
gettimeofday(&end, NULL);
cout << "花费了" << end.tv_sec - start.tv_sec << " s." << endl;
cout << "花费了" << end.tv_usec - start.tv_usec << " us." << endl;