NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
instrument.f File Reference

Monitor wall-clock times, etc. More...

Go to the source code of this file.

Functions/Subroutines

subroutine instrument (k, kall, ttot, tmin, tmax)
 This subprogram is useful in instrumenting a code by monitoring the number of times each given section of a program is invoked as well as the minimum, maximum and total wall-clock time spent in the given section.
 

Detailed Description

Monitor wall-clock times, etc.

Author
Mark Iredell
Date
1998-07-16

Definition in file instrument.f.

Function/Subroutine Documentation

◆ instrument()

subroutine instrument ( integer, intent(in)  k,
integer, intent(out)  kall,
real, intent(out)  ttot,
real, intent(out)  tmin,
real, intent(out)  tmax 
)

This subprogram is useful in instrumenting a code by monitoring the number of times each given section of a program is invoked as well as the minimum, maximum and total wall-clock time spent in the given section.

Program history log:

  • Mark Iredell 1998-07-16
  • Frimel and Kalina 2019-09-17 Decompose return statistcs if statement
  • Boi Vuong 2020-04-02 Check for ka > 0 and modifiled ifblock statement into two separate ifblock statements.
    Parameters
    [in]KInteger positive section number or maximum section number in the first invocation or zero to reset all wall-clock statistics or negative section number to skip monitoring and just return statistics.
    [out]KALLinteger number of times section is called.
    [out]TTOTreal total seconds spent in section.
    [out]TMINreal minimum seconds spent in section.
    [out]TMAXreal maximum seconds spent in section.
    Note
    This subprogram should not be invoked from a multitasking region. Normally, time spent inside this subprogram is not counted. Wall-clock times are kept to the nearest millisecond.
    Example.
         CALL INSTRUMENT(2,KALL,TTOT,TMIN,TMAX)    ! KEEP STATS FOR 2 SUBS
         DO K=1,N
           CALL SUB1
           CALL INSTRUMENT(1,KALL,TTOT,TMIN,TMAX)  ! ACCUM STATS FOR SUB1
           CALL SUB2
           CALL INSTRUMENT(2,KALL,TTOT,TMIN,TMAX)  ! ACCUM STATS FOR SUB2
         ENDDO
         PRINT *,'SUB2 STATS: ',KALL,TTOT,TMIN,TMAX
         CALL INSTRUMENT(-1,KALL,TTOT,TMIN,TMAX)   ! RETURN STATS FOR SUB1
         PRINT *,'SUB1 STATS: ',KALL,TTOT,TMIN,TMAX
     
Author
Mark Iredell
Date
1998-07-16

Definition at line 46 of file instrument.f.