subroutine option_stopwatch (default_clock, io_unit_print, io_unit_error, print_errors, abort_errors, print_form, err)
Sets options that control the behavior of StopWatch . All arguments are optional and have intent IN, with the exception of the status code err which has intent OUT. These options are global in nature, and remain in effect until another call to option_stopwatch changes them.
The argument default_clock determines what clocks will be used for all subsequent operations in which the clock argument is omitted. This allows you to specify what clocks you are interested in once and for all, and not have to specify those clocks with every subroutine call. The initial default value is (/'cpu ', 'user', 'sys ', 'wall'/), i.e., all clocks. However, if any clocks are not available in the implementation, they will be automatically removed from the list of default clocks.
Printed output can be redirected to any valid I/O unit number. io_unit_print determines the unit for output from subroutine print_watch. io_unit_error determines the unit for any error messages printed by StopWatch . When an I/O unit is reset by one of these variables, the unit must already be open for writing. The initial default is 6 for both I/O units, which is standard output on many systems.
What to do when an error occurs is controlled by the two logical variables print_errors and abort_errors. If print_errors is TRUE, then an error message will be printed to io_unit_error whenever an error condition occurs. In all cases where an error can be detected, the program can continue to execute, although the behavior of StopWatch might not be as expected. If abort_errors is TRUE, then the program will terminate when an error condition occurs. The initial defaults are TRUE for print_errors and FALSE for abort_errors.
The argument print_form determines the form for printing time when form
is omitted in print_watch. Currently all the forms print the time to .01 seconds. The valid values for print_form are:
The default value is 'sec'.
If present, the optional intent OUT integer argument err returns a status code. The code is the sum of the values listed below.
The relevant status codes and messages are:
In addition to the run time diagnostics generated by StopWatch
, the following
problem may arise:
call option_stopwatch(default_clock='cpu', abort_error=.true.)
call option_stopwatch(io_unit_print=11, io_unit_error=12)
The first call sets the default clock to be the cpu clock and says to terminate the program if an error occurs. The second call reassigns the I/O units.