second(3F)

SECOND - Returns elapsed CPU time

As shipped in IRIX 6.5.30. Last changed in IRIX 6.5.19.

NAME
     SECOND - Returns elapsed CPU time

SYNOPSIS
     second=SECOND()

DESCRIPTION
     SECOND returns the elapsed user CPU time as a real number in seconds
     (a default REAL*4) since the start of a program, including time
     accumulated by all processes in a multitasking program.

     SECOND returns execution time only for the current program.  For
     example, a script runs a 50-second program 10 times.  A SECOND call at
     the end of the 10th run (or 1st or 3rd or 7th) returns 50 seconds.

     The second argument is the result, or CPU time (in type real seconds)
     accumulated by all processes in a program.

WARNINGS
     If you are trying to time your entire program, and you are using
     Autotasking, the CPU time returned by SECOND may not reflect all of
     the CPU time used by your program.  This is due to the fact that slave
     CPUs may be still active when your program terminates (for instance,
     with a STOP or END statement).  Depending on the number of active CPUs
     on your machine, the extra time needed to terminate the slaves may be
     substantial compared with your program time.  Thus, if you use SECOND
     to time your program, and you are also using time(1) or ja(1), the
     time reported by these other utilities could be much higher than that
     reported by SECOND.

     Because of the large variation on multiple processors, SECOND should
     be used cautiously in multitasked routines.  On IRIX systems, the
     presence of multitasking does not affect the accuracy of SECOND.

EXAMPLES
     Example 1:  This example calculates the CPU time used in DOWORK:

          BEFORE = SECOND( )
          CALL DOWORK( )
          AFTER = SECOND( )
          CPUTIME = AFTER - BEFORE

     Example 2:  If the CPU time is small enough that the overhead for
     calling SECOND may be significant, the following example is more
     accurate:

          T0 = SECOND( )
          OVERHEAD = SECOND( ) - T0
          BEFORE = SECOND( )
          CALL DOWORK( )
          AFTER = SECOND( )
          CPUTIME = (AFTER - BEFORE) - OVERHEAD

SEE ALSO
     RTC(3I), SECONDR(3F), TIMEF(3F), TSECND(3F)

     ja(1), time(1)