Oracle DBMS UTILITY CPU Time
Jump to navigation
Jump to search
Oracle 10g added this new function to measure the amount of CPU time by capturing the metric between two points.
variable t1 NUMBER
variable cpu1 NUMBER
BEGIN
:t1 := dbms_utility.get_time;
:cpu1 := dbms_utility.get_cpu_time;
dbms_application_info.set_client_info(0);
END;
/
-- Sample CPU Only
Begin
FOR i IN 1..1000000 LOOP
NULL;
END LOOP;
END;
/
-- Sample CPU and I/O
Begin
FOR i IN (SELECT * FROM all_objects) LOOP
NULL;
END LOOP;
END;
/
SELECT
dbms_utility.get_time - :t1 AS time_hsecs,
dbms_utility.get_cpu_time - :cpu1 AS cpu_hsecs,
userenv('client_info') as calls
FROM dual;
Read more at http://www.oracle-developer.net/display.php?id=307