23.1 OEStopWatch

This is a nice simple class for timing scripts and programs. Simply create an instance of the OEStopwatch class. It has a Start() and Stop() method. Elapsed() is used to output the time elapsed since start. For example:

sw = OEStopwatch()
sw.Start()
 ... Do something that takes some time
print "That took", sw.Elapsed(), "seconds."

One quirk of the OEStopWatch class is that to work around operating system limitations, values below 2147 seconds (about 35 minutes) are based on a high-resolution CPU-usage timer (using ``clock(3)'') and after that report Wall-clock times accurate to about a second (using ``time(3)'').