timer_test, a Python code which examines methods for computing the elapsed CPU time of a part of a calculation.

In Python, CPU time can be read using the clock() function from the time module:

        from time import clock

        t1 = clock ( )
        carry out operations to be timed
        t2 = clock ( ) - t1
        print 'Operations completed after %g seconds' % ( t2 )


The computer code and data files described and made available on this web page are distributed under the MIT license.


timer_test is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

TIMESTAMP, a Python code which displays the current wall clock time.

WTIME, a Python code which returns a reading of the wall clock time in seconds.

Source Code:

Last revised on 13 May 2013.