wtime


wtime, a Python code 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 )
      

Licensing:

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

Languages:

wtime 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:

timer, Python codes which demonstrate how to compute CPU time or elapsed time.

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

Source Code:


Last revised on 19 January 2020.