This function returns the amount of time that SQL Server has spent in active operation since its latest start. @@CPU_BUSY
returns a result measured in CPU time increments, or “ticks.” This value is cumulative for all CPUs, so it may exceed the actual elapsed time. To convert to microseconds, multiply by [@@TIMETICKS](./timeticks-transact-sql.md).
[!NOTE]
If the time returned in @@CPU_BUSY or @@IO_BUSY exceeds 49 days (approximately) of cumulative CPU time, you may receive an arithmetic overflow warning. In that case, the value of the@@CPU_BUSY
,@@IO_BUSY
and@@IDLE
variables are not accurate.
Transact-SQL Syntax Conventions
@@CPU_BUSY
integer
To see a report containing several SQL Server statistics, including CPU activity, run sp_monitor.
This example returns SQL Server CPU activity, as of the current date and time. The example converts one of the values to the float
data type. This avoids arithmetic overflow issues when calculating a value in microseconds.
Here is the result set.
CPU microseconds As of
---------------- -----------------------
18406250 2006-12-05 17:00:50.600
sys.dm_os_sys_info (Transact-SQL)
[@@IDLE (Transact-SQL)](../../t-sql/functions/idle-transact-sql.md)
[@@IO_BUSY (Transact-SQL)](../../t-sql/functions/io-busy-transact-sql.md)
sp_monitor (Transact-SQL)
System Statistical Functions (Transact-SQL)