在我们的暂存环境中运行性能测试时,我偶尔会运行以下查询:
declare @ts_now bigint
select @ts_now = ms_ticks from sys.dm_os_sys_info
select dateadd (ms, (y.[timestamp] -@ts_now),
GETDATE()) as EventTime,
SQLProcessUtilization,
SystemIdle,
100 - SystemIdle - SQLProcessUtilization as OtherProcessUtilization
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
这返回
谁能解释我如何得到一个负数的利用率?我在尝试从 SQL Server CPU 利用率大于系统 CPU 利用率的 PSS 诊断中找出 CPU 利用率问题时发现了这一点。
我还没有弄清楚这两个问题,但我必须假设它们是相关的。