@@CPU_BUSY (Transact-SQL)

Returns the time that SQL Server has spent working since it was last started. Result is in CPU time increments, or "ticks," and is cumulative for all CPUs, so it may exceed the actual elapsed time. Multiply by @@TIMETICKS to convert to microseconds.

Note

If the time returned in @@CPU_BUSY or @@IO_BUSY exceeds approximately 49 days of cumulative CPU time, you receive an arithmetic overflow warning. In that case, the value of @@CPU_BUSY, @@IO_BUSY and @@IDLE variables are not accurate.

Topic link iconTransact-SQL Syntax Conventions

Syntax

@@CPU_BUSY

Return Types

integer

Remarks

To display a report containing several SQL Server statistics, including CPU activity, run sp_monitor.

Examples

The following example shows returning SQL Server CPU activity as of the current date and time. To avoid arithmetic overflow when converting the value to microseconds it converts the one of the values to float data type.

SELECT @@CPU_BUSY * CAST(@@TIMETICKS AS FLOAT) AS 'CPU microseconds', 
   GETDATE() AS 'As of' ;

Here is the result set.

CPU microseconds As of
---------------- -----------------------
18406250         2004-10-22 13:22:50.600

See Also

Reference

@@IDLE (Transact-SQL)
@@IO_BUSY (Transact-SQL)
sp_monitor (Transact-SQL)
System Statistical Functions (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance