Difference between revisions of "Oracle DBMS UTILITY CPU Time"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
(Created page with "<pre> 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; / -...")
 
Line 36: Line 36:
  
 
</pre>
 
</pre>
 +
 +
[[Category:Database_Scripts]]

Revision as of 15:50, 14 May 2012


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;