Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- GO 언어
- Callback
- c++
- C
- channel
- install
- http
- range
- 책
- mutex
- Close
- 영화
- 리뷰
- Golang
- go언어
- Sync
- windows
- go
- Linux
- window
- Python
- write
- FOR
- JavaScript
- tcp
- API
- File
- json
- bitcoin
- package
Archives
- Today
- Total
Code Habit
[c/c++] 프로세스 수행 시간 측정 본문
개발을 하다보면 부하가 걸리는 부분의 로직별 수행시간을 측정할 필요가 있다. 다음 소스를 사용하면 ms(마이크로세컨드) 단위로 수행속도를 측정할 수 있다.
#include <stido.h>
#include <time.h>
int main(void)
{
clock_t start, end;
start = clock();
// 수행할 로직
end = clock();
printf("%f\n", ((double)(end-start)) / CLOCKS_PER_SEC);
}
CLOCKS_PER_SEC은 ms(마이크로세컨드)를 s(초)단위로 변경할 때 쓰이는 매크로 상수이다.