⊙ 响应时间

来源:互联网 发布:网络诈骗报警能追回吗 编辑:程序博客网 时间:2024/05/19 02:40
我们知道系统的响应时间等于CPU服务的时间+等待时间
 
Response Time = Service Time + Wait Time
 
服务时间代表的是“ CPU used by this session”,是CPU服务会话所花费的所有时间
 
分两种。
1. 实例级。
 
select a.value "Total CPU time"
from v$sysstat a
where a.name = 'CPU used by this session';
 
2. 会话级

SQL> select statistic# from v$statname where name = 'CPU used by this session';

STATISTIC#
----------
        12
SQL> select sid,a.value "Total CPU time"
  2  from v$sesstat a
  3  where a.statistic# = 12
  4  /

Service Time = SQL解析时间 + 递归调用时间 + 其它时间

select a.value "Total parse CPU time" from v$sysstat a where a.name = 'parse time cpu'

recursive cpu usage  == ‘递归调用时间’

其他时间===>

select a.value "Total CPU",
b.value "Parse CPU",
c.value "Recusive CPU",
a.value - b.value - c.value "Other"
from v$sysstat a, v$sysstat b, v$sysstat c
where a.name = 'CPU used by this session'
and b.name = 'parse time cpu'
and c.name = 'recusive cpu usage'

等待事件

select EVENT,TIME_WAITED,AVERAGE_WAIT
from v$system_event
where event not in ('pmon timer',
                    'smon timer',
                    'rdbms ipc message',
                    'parallel dequeue wait',
                    'virtual circuit',
                    'SQL*Net message from client',
                    'client message',
                    'NULL event') order by time_waited desc;