alright, so I got my program written out in c++, but I want to know how long it takes to run. So I'm wondering if anyone knows anysort of timer functions? I need the most time effecient one, granted it would only run once (or twice depending on the function), but there is still an emphasis on time. as for operating system I am using Yoper linux, I don't know if it matters, but I've heard it does.
Name:
Anonymous2006-02-03 23:26
gettimeofday (in sys/time.h) is accurate to microseconds
Name:
Anonymous2006-02-03 23:29
If all you want is to find out how long it takes for the entire program to execute, there's an even easier way:
$ time a.out
Run that four times, and use the average of the last three runs.
Name:
Anonymous2006-02-05 8:55
>>3
To explain the "last three of four trials" part, the first run puts as much of the program as possible into the computer's RAM, which removes variables like disk read times. After removing some variables, the last three runs should be a more representative sample of your program's execution time.