728x90
반응형
MS SQL 의 DMV로 서버의 CPU 사용율을 확인할 수 있는 대안이 필요하다.
DECLARE @ts_now BIGINT;
SELECT @ts_now = cpu_ticks/(cpu_ticks/ms_ticks)
FROM sys.dm_os_sys_info;
SELECT TOP(10)
SQLProcessUtilization AS sql_server_process_cpu,
SystemIdle AS system_idle_process_cpu,
100 - SystemIdle - SQLProcessUtilization AS other_process_cpu,
DATEADD(ms, -1 * (@ts_now - [timestamp]), GETDATE()) AS event_time
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 DESC;
728x90
반응형
'운영 > 성능 및 실행계획' 카테고리의 다른 글
Performance Counter 수집 - Transaction/sec (0) | 2014.01.28 |
---|---|
Buffer cache hit ratio 수집 (0) | 2014.01.24 |
File IO 성능 확인 (0) | 2014.01.23 |
캐쉬된 실행 계획 보기(Investigating the plan cache) (0) | 2013.12.01 |
성능 카운터 정보를 DB에 저장하기 (0) | 2013.12.01 |