Sql script to get the CPU busy time
in sql server since last time sql server had started.
SELECT @@CPU_BUSY AS
[Busy Time]
Sample Output:
Busy Time
|
120
|
To get in seconds
:
SELECT @@CPU_BUSY *
CAST(@@TIMETICKS AS FLOAT) / 1000000 AS [Busy
Time(Second)]
To get the CPU busy time during the
execution of some sql queries:
DECLARE @BusyTime AS INT
SET @BusyTime = @@CPU_BUSY
/*
Sql statements
*/
SELECT @@CPU_BUSY - @BusyTime AS
[Busy Time]
No comments:
Post a Comment