DT_STOPWATCH implements a simple stopwatch that can be used for low precision timing of program excution speed. Since DT_STOPWATCH relies on the system time, the actual timing results will depend on what other processes are running, memory usage and CPU load. However if the timing of different executions is done under similar system load you will get comparable timing results that can be useful for quick evaluation of code changes on performance.
For detailed analysis of program execution time and bottlenecks you should of course use the profiling tools available on your platform.
Some additional features that could be added to DT_STOPWATCH are:
elapsed_times: DS_LIST [DT_DATE_TIME_DURATION] -- All elapsed times since the creation of the stopwatch
average_elapsed_time: DT_DATE_TIME_DURATION -- The average elapsed time over all start/stop measurements
Other stopwatch classes could be implemented so that they could rely on customized clocks, for example clocks running twice as fast as the system clock.
Copyright © 2009-2016, Eric
Last Updated: 27 December 2016