Compute Elapsed Wallclock Time

WTIME is a Python library which shows how to obtain readings of the wall clock time using time() or clock().

For parallel programming, the important thing to measure is the elapsed wallclock time. This can be found by subtracting an initial reading of the wallclock time from a final one.

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

        from time import time

        t1 = time ( )
        carry out operations to be timed
        t2 = time ( ) - 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 GNU LGPL license.


WTIME is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

TIMER, Python programs which demonstrate how to compute CPU time or elapsed time.

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

Source Code:

You can go up one level to the Python source codes.

Last revised on 16 October 2016.