I am coding in c++ and working on Visual Studio 2010. I am trying to compute the time that a function takes to execute, here is my code
double sum=0; clock_t start_s=clock(); for(int j=1;j<size;j++) { int key=data[j]; int i=j-1; while(i>=0 && data[i]>key) { data[i+1]=data[i]; i=i-1; } data[i+1]=key; } clock_t stop_s=clock(); sum=((double)(stop_s - start_s)/CLOCKS_PER_SEC); but the problem is that the time computes to 0. How can I measure the time in even smaller unit