Sun Studio 12: Fortran Library Reference etime: Elapsed Time Since Start of Execution

For etime, the elapsed time is:

The runtime library determines that a program is executing in a multiprocessor mode if either the PARALLEL or OMP_NUM_THREADS environment variables are defined to some integer value greater than 1.

The function is called by:

e = etime( tarray )




e= -1.0: Error: tarray values are undefined.

e≠ -1.0: Single Processor: User time in tarray(1). System time in tarray(2)

Multiple Processor: Wall clock time in tarray(1), 0.0 in tarray(2)

Return value 



e= -1.0: Error

e≠ -1.0: The sum of tarray(1) and tarray(2)

Take note that the initial call to etime will be inaccurate. It merely enables the system clock. Do not use the value returned by the initial call to etime.

Example: etime(), single processor:

demo% cat tetime.f
       real e, etime, t(2)
       e = etime(t)         !  Startup etime - do not use result
       do i = 1, 10000
       end do
       e = etime( t )
       print *, ’elapsed:’, e, ’, user:’, t(1), ’, sys:’, t(2)
demo% f95 tetime.f
demo% a.out
elapsed: 0.02 , user: 0.01 , sys: 0.01

See also times(2), and the Fortran Programming Guide.