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.

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.

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

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.