블로그 이미지
010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (500)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글

cpu 사용량

카테고리 없음 / 2012. 1. 1. 01:07

alter view cpu_percent
as
select
 top 256 record_id,
 dateadd(ms, -1 * ( (select cpu_ticks / convert(float, ms_ticks) from sys.dm_os_sys_info) - [timestamp]), GetDate()) as EventTime,
 SQLProcessUtilization,
 SystemIdle,
 100 - SystemIdle - SQLProcessUtilization as OtherProcessUtilization
 -- system idle 값과 SQLProcessUtilization 값을 이용해서 SQL 외 cpu 사용율을 계산 합니다.
from (
  select
   record.value('(./Record/@id)[1]', 'int') as record_id,
   record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') as SystemIdle,
   record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') as SQLProcessUtilization,
   timestamp
  from (
   select timestamp, convert(xml, record) as record
   from sys.dm_os_ring_buffers
   where ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR'
   and record like '%<SystemHealth>%'
   ) as x
 ) as y
order by record_id asc
Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함