Question

I'm working on measuring the performance impact of Backups on CPU. I would like to capture all the backup operations and CPU usage. I'm running a weekly full backup, daily diff, and 15 min log backup. Are there any options in Extended Events we can use to capture CPU usage?

CREATE EVENT SESSION [Backup_Events_Trace] ON SERVER ADD EVENT sqlserver.backup_restore_progress_trace (ACTION(sqlserver.client_hostname, sqlserver.database_name))
    ,ADD EVENT sqlserver.databases_backup_restore_throughput (ACTION(sqlserver.client_hostname, sqlserver.database_name)) ADD TARGET package0.event_file (SET filename = N'L:\XE\Backup_Events_Trace.xel')
    WITH (STARTUP_STATE = OFF)
GO
Was it helpful?

Solution

You can fetch CPU utilisation by adding this event:

sqlos.scheduler_monitor_system_health_ring_buffer_recorded

Adding this to your Extended Events session will return CPU utilisation statistics (among others).

When you query the data, there are two fields - process_utilization and system_idle which represents the SQL process CPU utilisation and the idle CPU % respectively. By subtracting process_utilization from system_idle you get the non-SQL used CPU from the server.

OTHER TIPS

In addition as far as I know you might get the CPU usage from the inbuilt system health extended events as well.

It keeps a track of the CPU metrics along with queries ran. You may want to tweak as needed if interested. Else you can always go for other events or pulling data from cache using DMVs if possible

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top