home *** CD-ROM | disk | FTP | other *** search
- SECOND(3F) Last changed: 1-22-99
-
-
- NNAAMMEE
- SSEECCOONNDD - Returns elapsed CPU time
-
- SSYYNNOOPPSSIISS
- All systems:
-
- _s_e_c_o_n_d==SSEECCOONNDD(())
-
- UNICOS systems:
-
- CCAALLLL SSEECCOONNDD((_s_e_c_o_n_d))
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- UNICOS, UNICOS/mk and IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- SSEECCOONNDD returns the elapsed user CPU time as a real number in seconds
- (a default RREEAALL**44) since the start of a program, including time
- accumulated by all processes in a multitasking program.
-
- SSEECCOONNDD returns execution time only for the current program. For
- example, a script runs a 50-second program 10 times. A SSEECCOONNDD call at
- the end of the 10th run (or 1st or 3rd or 7th) returns 50 seconds.
-
- On UNICOS systems, SSEECCOONNDD 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 SSEECCOONNDD 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 _s_e_c_o_n_d argument is the result, or CPU time (in type real seconds)
- accumulated by all processes in a program.
-
- NNOOTTEESS
- On UNICOS systems, the initial call to SSEECCOONNDD may take longer than
- subsequent calls due to certain initializations performed by the
- routine. If the cost of calling SSEECCOONNDD is important, ignore the
- initial call when computing SSEECCOONNDD's time. The calculation of
- OOVVEERRHHEEAADD in the second example, following, serves this purpose. On
- UNICOS systems, the CPU times gathered by SSEECCOONNDD include
- wait-semaphore time.
-
- WWAARRNNIINNGGSS
- If you are trying to time your entire program, and you are using
- Autotasking, the CPU time returned by SSEECCOONNDD 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 SSTTOOPP or EENNDD 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 SSEECCOONNDD
- to time your program, and you are also using ttiimmee(1) or jjaa(1), the
- time reported by these other utilities could be much higher than that
- reported by SSEECCOONNDD.
-
- Because of the large variation on multiple processors, SSEECCOONNDD should
- be used cautiously in multitasked routines. On IRIX systems, the
- presence of multitasking does not affect the accuracy of SSEECCOONNDD.
-
- EEXXAAMMPPLLEESS
- Example 1: This example calculates the CPU time used in DDOOWWOORRKK:
-
- BEFORE = SECOND( )
- CALL DOWORK( )
- AFTER = SECOND( )
- CPUTIME = AFTER - BEFORE
-
- Example 2: If the CPU time is small enough that the overhead for
- calling SSEECCOONNDD may be significant, the following example is more
- accurate:
-
- T0 = SECOND( )
- OVERHEAD = SECOND( ) - T0
- BEFORE = SECOND( )
- CALL DOWORK( )
- AFTER = SECOND( )
- CPUTIME = (AFTER - BEFORE) - OVERHEAD
-
- SSEEEE AALLSSOO
- RRTTCC(3I), SSEECCOONNDDRR(3F), TTIIMMEEFF(3F), TTSSEECCNNDD(3F)
-
- jjaa(1), ttiimmee(1) in the _U_N_I_C_O_S _U_s_e_r _C_o_m_m_a_n_d_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l
-
- _A_p_p_l_i_c_a_t_i_o_n _P_r_o_g_r_a_m_m_e_r'_s _L_i_b_r_a_r_y _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for the printed
- version of this man page.
-