본문 바로가기

자료구조

1-6강 - Performance measurement (시간 측정)

0. Intro

1> C standard library를 이용한다. 

#include <time.h>

1. Method 1

start = clock();
stop = clock();
duration = ((double)(stop-start))/CLOCKS_PER_SEC;

2. Method 2

start = time(NULL);
stop = time(NULL);
duration = (double)difftime(stop,start);