14.3. Retrieving and Displaying the Elapsed Time

PLVtmr offers several different programs to retrieve and display the elapsed time: elapsed, elapsed_message, and show_elapsed. To get a non-NULL result from these programs, you must first have called the capture procedure.

The elapsed function returns the number of hundredths of seconds since the last call to capture. Its header is:


You will want to use elapsed when you wish to store the elapsed time, rather than display it, or when you wish to display it in a format not supported by the other programs of PLVtmr.

14.3.1. elapsed_message Function

The elapsed_message function returns the elapsed time displayed within a standard format that incorporates the iteration factor (see Section 14.4). The header for elapsed_message follows:

FUNCTION elapsed_message
   (prefix_in IN VARCHAR2 := NULL,
    adjust_in IN NUMBER := 0,
    reset_in IN BOOLEAN := TRUE,
    reset_context_in IN VARCHAR2 := NULL)

The first argument, prefix_in, is another "context" string. In addition to the string provided in the call to capture, you can pass additional information to the PLVtmr package to display with the elapsed timing message. The value of the adjust_in argument allows you adjust or calibrate your timing with any overhead computations you may have made. The reset_in argument indicates whether or not the capture procedure should be called to "reset" the starting time of the next elapsed timing. The final argument, ...

Get Advanced Oracle PL/SQL Programming with Packages now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.