question

bmurali09 avatar image
bmurali09 asked

What is the best way to get CPU Utilization?

Hi, Please help me to get a t-SQL query for finding high CPU Usage. Regards Murali
performanceadministrationcpu
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Magnus Ahlkvist avatar image
Magnus Ahlkvist answered
There's an old discussion on SQL Server Central forum, for a question just as vague as yours. http://www.sqlservercentral.com/Forums/Topic611107-146-1.aspx Don't know if that would answer your question. Please be more specific when asking questions - that way it's easier to answer them. If the discussion above is useful for you, please be aware that at least in SQL Server 2014 the first query posted by "MarkusB" won't work - you need to replace cpu_ticks_in_ms with ms_ticks.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Magnus Ahlkvist avatar image Magnus Ahlkvist commented ·
And did you then try to run the statements in the query separately, to find out which statement caused the overflow? Since I'm not getting an arithmetic overflow on my own system, it's rather hard to guess where it might have gone wrong on yours. Run the statements separately, break out the subqueries and run them separately, run the outer query without the subquery, run the outer query with just the calculation @ts_now-[timestamp] etc. Isolate the error and find out which statement causes the error, and then work from there. You probably need to cast some value to bigint prior to using it in a calculation. But as I said: Since I don't get any errors on my own system, I can't really guess which statement is causing the error on yours.
1 Like 1 ·
bmurali09 avatar image bmurali09 commented ·
Hi Magnus, I'm getting error while using on above query got from the link in 2012 standard edition. Please find the error below. **Msg 8115, Level 16, State 2, Line 5 Arithmetic overflow error converting expression to data type int.**
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.