one way is to buy a commercial profiler program :)
But the easiest way is to call clock() to get the current time before starting the algorithm, then call it again after the algorithm is finished. The difference is the execution time. But be warned that the algorithm might execute so quickly that the time is unmeasurable. In that case call the algorithm in a loop for maybe a thousand or so times.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
If your using Linux the "time" command will do nicely.
time() resolution is only to 1 second -- not accurate enough for profiling. clock() however normally has a resolution of 1 millisecond.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Ancient Dragon
time is a command.
usage: time
Oh. I thought you were talking about the time functions in time.h know if time has been ported to Windoze.
I don't think so.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343