5.27. PLVtmr: Program Performance Analyzer

The PLVtmr (PL/Vision TiMeR) package allows you to measure the elapsed time of PL/SQL code; it provides a programmatic layter around the GET_TIME function of Oracle's DBMS_UTILITY package. See Chapter 14 for details.

5.27.1. Control execution of timings

PROCEDURE turn_on;

Enables the timing package. All PLVtmr programs will execute as requested.

PROCEDURE turn_off;

Disables PLVtmr. Calls to timing programs will be ignored.

5.27.2. Setting the repetition value

PROCEDURE set_repeats (repeats_in IN NUMBER);

Sets the number of repetitions for all timing loops implemented inside the PLVtmr package (calibrate, func, currsucc, currfail).

FUNCTION repeats RETURN NUMBER;

Returns the current repetition value.

5.27.3. Setting the factoring value

PROCEDURE set_factor (factor_in IN NUMBER);

Sets the number of iterations when calling PLVtmr in a loop. This value allows PLVtmr to show total and individual elapsed times.

FUNCTION factor RETURN NUMBER;

Returns the current number of iterations.

5.27.4. Capturing the current timestamp

PROCEDURE capture (context_in IN VARCHAR2 := NULL);

Calls capture to capture the current timestamp (usually the start time of an elapsed time calculation). You can provide an optional context for the timing.

5.27.5. Retrieving and displaying elapsed time

FUNCTION elapsed RETURN NUMBER;

Returns the number of hundredths of seconds elapsed since last call to capture.

FUNCTION elapsed_message (prefix_in IN ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.