This is my blog in where I'll share all my DBA experience and sql scripts.
Este es mi blog donde comparto toda mi experiencia como DBA y algunos scripts.
Thursday, November 3, 2011
Get CPU usage history
This script helps you to easily check the CPU usage of your SQL Server. You can get SQL CPU usage , Other processes CPU usage(Non-SQL) and the total usage for the previous 2 hours. Helpful to understand the usage patterns as well as to create a baseline.
-- CPU Usage History
declare @ts_now bigint
--SELECT @ts_now = cpu_ticks / convert(float, cpu_ticks_in_ms) from sys.dm_os_sys_info -- (Use this line if server is SQL 2005)
SELECT @ts_now = ms_ticks fromsys.dm_os_sys_info-- (Use this line if server is SQL 2008 or above)