wtime


wtime, a C code which returns a reading of the wall clock time.

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.

The OpenMP system provides a function used as follows:

        seconds = omp_get_wtime ( )
        operations to time;
        seconds = omp_get_wtime ( ) - seconds;
      
while the MPI system provides a similar function used as:
        seconds = MPI_Wtime ( );
        operations;
        seconds = MPI_Wtime ( ) - seconds;
      
and in MATLAB, wallclock time can be taken with "tic" and "toc":
        tic;
        operation;
        seconds = toc;
      

WTIME provides a way to get a similar reading:

        seconds = wtime ( );
        operations;
        seconds = wtime ( ) - seconds;
      

Licensing:

The information on this web page is 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:

wtime_test

timer, a C code which shows how to compute the elapsed CPU time inside a program.

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

Source Code:


Last revised on 27 July 2019.