Manual Reference Pages  - OPTION_STOPWATCH (3)

NAME

option_stopwatch(3f) - [M_stopwatch] sets M_StopWatch options (LICENSE:PD)

CONTENTS

Synopsis
Description
Diagnostics
Examples
Bugs
Author
See Also

SYNOPSIS

subroutine option_stopwatch(default_clock, io_unit_print, io_unit_error, print_errors, abort_errors, print_form, err)

character(len=*), optional, intent(IN) :: default_clock(:)
OR character(len=*), optional, intent(IN) :: default_clock

integer, optional, intent(IN) :: io_unit_print, io_unit_err
logical, optional, intent(IN) :: print_errors, abort_errors
character(len=*), optional, intent(IN) :: print_form
integer, optional, intent(OUT) :: err

DESCRIPTION

Sets options that control the behavior of M_StopWatch. All arguments are optional and have intent IN (except 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 M_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 M_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_errors
.The valid values are: .IP ’sec’, seconds
’hh:mm:ss’, colon separated hours, minutes and seconds
’[[hh:]mm:]ss’, same as ’hh:mm:ss’ except hours and minutes are printed only if nonzero The default value is ’sec’.

DIAGNOSTICS

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:

0 No errors; execution successful.

8 Invalid clock type. This occurs if default_clock is present and one of the specified clocks is not supported by the implementation. See inquiry_stopwatch(3) to determine what clocks are available.

16 Too many clocks specified. This occurs when the argument default_clock is an array longer than four.

256 I/O unit is not open for writing. The I/O unit requested for io_unit_print or io_unit_error is not open for writing.

512 Failed to allocate required memory. This error occurs if the Fortran allocate statement returns a nonzero status indicating that memory could not be allocated. Avoid memory leaks by always destroying watches and groups before recreating them, and destroying local variable watches and groups before returning from a subroutine.

1024 Error occurred while deallocating memory. This error occurs if the Fortran deallocate statement returns a nonzero status while deallocating memory. Be aware that other problems could develop as a result of the deallocate error.

2048 Illegal output form. This error occurs if print_form is not one of the strings listed above.

In addition to the run time diagnostics generated by M_StopWatch, the following problems may arise:

o In Fortran 90, the character strings in an array constructor must all have the same length. Pad three letter clock names with a blank on the right to make a four character string, for example, ’cpu ’.

EXAMPLES

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.

BUGS

None known.

AUTHOR

William F. Mitchell, william.mitchell@nist.gov National Institute of Standards and Technology

SEE ALSO

M_stopwatch(3), create_watchgroup(3), create_watch(3), destroy_watchgroup(3), destroy_watch(3), end_pause_watch(3), inquiry_stopwatch(3), join_watchgroup(3), leave_watchgroup(3), pause_watch(3), print_watch(3), read_watch(3), reset_watch(3), start_watch(3), stop_watch(3)


M_StopWatch 1.1 OPTION_STOPWATCH (3) September 22, 2017
Generated by manServer 1.08 from option_stopwatch.3.txt using man macros.