wallClockElapseTime
Calculates and prints elapsed time.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" procedure wallClockElapseTime ( date : string, title : string, opt : integer )
Arguments
dateThe current date (i.e. date = systemfunc("date")).
titleA string that will become part of the output description.
optAn integer, currently not used.
Description
This procedure calculates and prints the elapsed time in seconds. It will not handle the case where the year or month changes.
Examples
The following require that contributed.ncl be loaded prior to invoking the function.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
The following prints wall clock time for different code sections and the overall time. Using different "start times" allows different code sections to be timed. These are italicized for emphasis.
wcStrt = systemfunc("date")
wcStrtClmP = systemfunc("date")
; : ; one or more statements [usually a block of code]
wallClockElapseTime(wcStrtClmP, "Processing", 0)
:
wcStartGraphics = systemfunc("date")
; : ; graphics code
wallClockElapseTime(wcStrtGraphics, "Graphics", 0)
wallClockElapseTime(wcStrt, "Processing and Graphics", 0)
The printed output will look like:
=====> Wall Clock Elapsed Time: Processing: 137 seconds <===== =====> Wall Clock Elapsed Time: Graphics: 19 seconds <===== =====> Wall Clock Elapsed Time: Processing and Graphics: 156 seconds <=====