SECOND man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]

SECOND(3F)					      Last changed: 2-24-98

NAME
     SECOND - Returns elapsed CPU time

SYNOPSIS
     All systems:

     second=SECOND()

     UNICOS systems:

     CALL SECOND(second)

IMPLEMENTATION
     UNICOS, UNICOS/mk and IRIX systems

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.

     On UNICOS systems, SECOND is not appropriate for timing small timed
     regions.  If the timed region is fewer than 4000 clock periods (CPs)
     in duration, the variation in the accuracy of SECOND can be 10% or
     more on one processor.  On multiple processors, the variation can be
     on the order of 10,000 to 400,000 CPs.

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

NOTES
     On UNICOS systems, the initial call to SECOND may take longer than
     subsequent calls due to certain initializations performed by the
     routine.  If the cost of calling SECOND is important, ignore the
     initial call when computing SECOND's time.	 The calculation of
     OVERHEAD in the second example, following, serves this purpose.  On
     UNICOS systems, the CPU times gathered by SECOND include
     wait-semaphore time.

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) in the UNICOS User Commands Reference Manual,
     publication SR-2011

     Application Programmer's Library Reference Manual, publication
     SR-2165, for the printed version of this man page.
[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net