home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / f90 / second.z / second
Encoding:
Text File  |  1998-10-30  |  3.9 KB  |  89 lines

  1. SECOND(3F)                                            Last changed: 2-24-98
  2.  
  3.  
  4. NNAAMMEE
  5.      SSEECCOONNDD - Returns elapsed CPU time
  6.  
  7. SSYYNNOOPPSSIISS
  8.      All systems:
  9.  
  10.      _s_e_c_o_n_d==SSEECCOONNDD(())
  11.  
  12.      UNICOS systems:
  13.  
  14.      CCAALLLL SSEECCOONNDD((_s_e_c_o_n_d))
  15.  
  16. IIMMPPLLEEMMEENNTTAATTIIOONN
  17.      UNICOS, UNICOS/mk and IRIX systems
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      SSEECCOONNDD returns the elapsed user CPU time as a real number in seconds
  21.      (a default RREEAALL**44) since the start of a program, including time
  22.      accumulated by all processes in a multitasking program.
  23.  
  24.      SSEECCOONNDD returns execution time only for the current program.  For
  25.      example, a script runs a 50-second program 10 times.  A SSEECCOONNDD call at
  26.      the end of the 10th run (or 1st or 3rd or 7th) returns 50 seconds.
  27.  
  28.      On UNICOS systems, SSEECCOONNDD is not appropriate for timing small timed
  29.      regions.  If the timed region is fewer than 4000 clock periods (CPs)
  30.      in duration, the variation in the accuracy of SSEECCOONNDD can be 10% or
  31.      more on one processor.  On multiple processors, the variation can be
  32.      on the order of 10,000 to 400,000 CPs.
  33.  
  34.      The _s_e_c_o_n_d argument is the result, or CPU time (in type real seconds)
  35.      accumulated by all processes in a program.
  36.  
  37. NNOOTTEESS
  38.      On UNICOS systems, the initial call to SSEECCOONNDD may take longer than
  39.      subsequent calls due to certain initializations performed by the
  40.      routine.  If the cost of calling SSEECCOONNDD is important, ignore the
  41.      initial call when computing SSEECCOONNDD's time.  The calculation of
  42.      OOVVEERRHHEEAADD in the second example, following, serves this purpose.  On
  43.      UNICOS systems, the CPU times gathered by SSEECCOONNDD include
  44.      wait-semaphore time.
  45.  
  46. WWAARRNNIINNGGSS
  47.      If you are trying to time your entire program, and you are using
  48.      Autotasking, the CPU time returned by SSEECCOONNDD may not reflect all of
  49.      the CPU time used by your program.  This is due to the fact that slave
  50.      CPUs may be still active when your program terminates (for instance,
  51.      with a SSTTOOPP or EENNDD statement).  Depending on the number of active CPUs
  52.      on your machine, the extra time needed to terminate the slaves may be
  53.      substantial compared with your program time.  Thus, if you use SSEECCOONNDD
  54.      to time your program, and you are also using ttiimmee(1) or jjaa(1), the
  55.      time reported by these other utilities could be much higher than that
  56.      reported by SSEECCOONNDD.
  57.  
  58.      Because of the large variation on multiple processors, SSEECCOONNDD should
  59.      be used cautiously in multitasked routines.  On IRIX systems, the
  60.      presence of multitasking does not affect the accuracy of SSEECCOONNDD.
  61.  
  62. EEXXAAMMPPLLEESS
  63.      Example 1:  This example calculates the CPU time used in DDOOWWOORRKK:
  64.  
  65.           BEFORE = SECOND( )
  66.           CALL DOWORK( )
  67.           AFTER = SECOND( )
  68.           CPUTIME = AFTER - BEFORE
  69.  
  70.      Example 2:  If the CPU time is small enough that the overhead for
  71.      calling SSEECCOONNDD may be significant, the following example is more
  72.      accurate:
  73.  
  74.           T0 = SECOND( )
  75.           OVERHEAD = SECOND( ) - T0
  76.           BEFORE = SECOND( )
  77.           CALL DOWORK( )
  78.           AFTER = SECOND( )
  79.           CPUTIME = (AFTER - BEFORE) - OVERHEAD
  80.  
  81. SSEEEE AALLSSOO
  82.      RRTTCC(3I), SSEECCOONNDDRR(3F), TTIIMMEEFF(3F), TTSSEECCNNDD(3F)
  83.  
  84.      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,
  85.      publication SR-2011
  86.  
  87.      _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, publication
  88.      SR-2165, for the printed version of this man page.
  89.