error while running CPU utilization query in ms sql #224
Unanswered
manikanta4653
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
/*
Author: Benjamin Nevarez
Original link: http://sqlblog.com/blogs/ben_nevarez/archive/2009/07/26/getting-cpu-utilization-data-from-sql-server.aspx
*/
DECLARE @ts_now BIGINT;
SELECT @ts_now = cpu_ticks / CONVERT(FLOAT, cpu_ticks)
FROM sys.dm_os_sys_info;
SELECT record_id
, Dateadd(ms, -1 * ( @ts_now - [timestamp])
, 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 '%%') AS x) AS y
ORDER BY record_id DESC;
Hi my name is manikanta.
while executing above query i am getting below error, please help me on this
Msg 8115, Level 16, State 2, Line 10 Arithmetic overflow error converting expression to data type int.
please reach out to me manikantakarnati1@gmail.com
Beta Was this translation helpful? Give feedback.
All reactions