I\'ve got something like this:
clock_t start, end;
start=clock();
something_else();
end=clock();
printf(\"\\nClock cycles are: %d - %d\\n\",start,end);
Well, do you want the time something_else()
takes? Try this:
#include
#include
#include
int main(void) {
struct timeval start, end;
long mtime, secs, usecs;
gettimeofday(&start, NULL);
something_else();
gettimeofday(&end, NULL);
secs = end.tv_sec - start.tv_sec;
usecs = end.tv_usec - start.tv_usec;
mtime = ((secs) * 1000 + usecs/1000.0) + 0.5;
printf("Elapsed time: %ld millisecs\n", mtime);
return 0;
}