DBMS_UTILITY.GET_TIME 为总消耗时间.
DBMS_UTILITY.GET_CPU_TIME为使用的cpu时间.
当进程处于sleep时,不会消耗cpu时间.
SQL> DECLARE 2 l_temp NUMBER; 3 BEGIN 4 l_temp := DBMS_UTILITY.get_cpu_time; 5 dbms_output.put_line('before=' || l_temp); 6 dbms_lock.sleep(5); 7 l_temp := DBMS_UTILITY.get_cpu_time; 8 dbms_output.put_line('after=' || l_temp); 9 END; 10 / before=10 after=10 PL/SQL procedure successfully completed SQL> SQL> DECLARE 2 l_temp NUMBER; 3 BEGIN 4 l_temp := DBMS_UTILITY.get_time; 5 dbms_output.put_line('before=' || l_temp); 6 dbms_lock.sleep(5); 7 l_temp := DBMS_UTILITY.get_time; 8 dbms_output.put_line('after=' || l_temp); 9 END; 10 / before=59955835 after=59956335 PL/SQL procedure successfully completed
measuring cpu time in 10g:http://www.oracle-developer.net/display.php?id=307
本文介绍了Oracle数据库中使用DBMS_UTILITY包的GET_CPU_TIME和GET_TIME过程来分别测量CPU时间和总消耗时间的方法。通过示例展示了在进程休眠期间,CPU时间保持不变而总时间继续增加的现象。
816

被折叠的 条评论
为什么被折叠?



