출처1: https://fias.uni-frankfurt.de/pm/issues/566
첨부 PDF 참조
https://fias.uni-frankfurt.de/pm/attachments/download/1496/chrono.pdf
출처2: http://www.cplusplus.com/reference/chrono/
시간 측정을 위해 chrono 사용법 간단 정리
1: #include <iostream>
2: #include <chrono>
3: using namespace std;
4: using namespace chrono; // std 내에 chrono 가 존재
5: int main(void) {
6: system_clock::time_point start = system_clock::now();
7: int a = 0;
8: for (int i = 0; i < 10000000; i++) {
9: a++;
10: }
11: system_clock::time_point end = system_clock::now();
12: microseconds microSec = duration_cast<microseconds>(end - start);
13: cout << microSec.count() << " us\n";
14: return 0;
15: }
시작
system_clock::time_point start = system_clock::now();
끝
system_clock::time_point end = system_clock::now();
시간 계산
microseconds microSec = duration_cast<microseconds>(end - start);
출력
cout << microSec.count() << " us\n";
us (micro seconds) : 1 / 1000000 sec
ms (milli seconds) : 1 / 1000 sec
댓글 없음:
댓글 쓰기