next up previous contents
Next: Subroutine cpu_second Up: StopWatch User's Guide Previous: Examples

Trouble Shooting

All StopWatch subroutines take an optional argument err as the last dummy argument. This is an INTENT(OUT) integer argument in which a status code is returned. The code is the sum of the values listed below.

Errors can also be determined through printed error messages. An error message will be printed to a specified I/O unit (6 by default) if print_errors is TRUE (default is TRUE; see Section 4.4). The error message contains more detail about the cause of the error than can be obtained from just the status code, so you should set print_errors to TRUE if you have trouble determining the cause of the error.

All errors are non-fatal. If abort_errors is FALSE (default is FALSE, see Section 4.4) the requested operation is ignored and execution will continue.

The relevant status codes and messages are:

0
-- operation successful; no errors.

1
-- Watch needs to be created. This occurs when you attempt to use a watch that has been destroyed. Some compilers might also generate this error when you attempt to use a watch that has never been created.

2
-- Watch is in the wrong state for this operation. This occurs when you attempt to start a watch that is already running, stop a watch that is not running, etc.

4
-- Watch is in an unknown state. This occurs if StopWatch does not recognize the state (running, stopped, etc.) that the watch is in. This error should not occur, and indicates an internal bug in StopWatch .

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

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

32
-- Number of names is not equal to number of watches. This occurs in create_watch if the array of watch names is not of the same length as the array of watches.

64
-- Character string too long. This occurs when a watch name with more than 132 characters is passed into create_watch.

128
-- Watch not found in given group. This occurs when you attempt to remove a watch from a group that it does not belong to.

256
-- I/O unit is not open for writing. This can occur from print_watch or when printing an error message.

512
-- Failed to allocate required memory. When a StopWatch routine is called with an array or group of watches, temporary memory is allocated. This error occurs if the 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, destroying local variable watches and groups before returning from a subroutine, and deallocating array results from read_watch.

1024
-- Error occurred while deallocating memory. This error occurs if the deallocate statement returns a nonzero status while deallocating temporary memory used for an array or group of watches. The operation is performed, but be aware that other problems could develop as a result of the deallocate error.

2048
-- Illegal output form. This error occurs in option_stopwatch or print_watch if the given print format is not one of the valid strings listed in section 4.4.



next up previous contents
Next: Subroutine cpu_second Up: StopWatch User's Guide Previous: Examples