SQL @@CPU_BUSY

SQL @@CPU_BUSY functions returns the total amount of time spent in the current operation since SQL Server last started. The syntax of @@CPU_BUSY is

@@CPU_BUSY

SQL @@CPU_BUSY Example

The below code snippet will show you the total time spent in active operation since this SQL Server last started.

-- SQL Server @@CPU_BUSY Example
SELECT @@CPU_BUSY AS 'CPU Busy Time'
SQL @@CPU_BUSY Example 1

You can use @@TIMETICKS to get active time or busy time in microseconds. Next, we used the GETDATE() function in SQL Server to see the total CPU busy time until today.

-- SQL Server @@CPU_BUSY Example
SELECT @@CPU_BUSY AS 'CPU Busy Time',
       @@CPU_BUSY * CAST(@@TIMETICKS AS FLOAT) AS 'CPU Busy Time in Microseconds',
	GETDATE() AS 'As Of Today'
SQL @@CPU_BUSY Example 2