Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: get_cpu_time vs. get_time

Re: get_cpu_time vs. get_time

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: 12 Jan 2007 08:57:46 -0800
Message-ID: <1168621066.722360.27830@a75g2000cwd.googlegroups.com>

cpiodumpv_at_gmail.com wrote:
> can someone explain this?
>
> >list
> 1 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;
> >/
> before=5
> after=5
>
> >list
> 1 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;
> >/
> before=76096444
> after=76096945
>
> PL/SQL procedure successfully completed.

GET_CPU_TIME returns how much CPU time your process actually used (less than 1 centisecond in this particular case.) No CPU was used by the process while it was sleeping. GET_TIME returns wall clock on every call, so the difference of 501 centiseconds is pretty close to what I would expect (I'd expect 500 on relatively idle system.)

Hth,

    Vladimir M. Zakharychev
    N-Networks, makers of Dynamic PSP(tm)     http://www.dynamicpsp.com Received on Fri Jan 12 2007 - 10:57:46 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US