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. Learn more about SQL GETDATE from our SQL tutorial page.

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

You can use SQL @@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. Also, check the SQL @@IO_BUSY article.

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
Categories SQL