CPU Usage using T-SQL

  • SQL 2008...

    declare @a as bigint, @b-2 as bigint

    select @a=sum(cntr_value)

    from sys.dm_os_performance_counters

    where object_name = 'SQLServer:Resource Pool Stats' and cntr_type = 537003264

    select distinct @b-2=cntr_value

    from sys.dm_os_performance_counters

    where object_name = 'SQLServer:Resource Pool Stats' and cntr_type = 1073939712

    select cast(@a as float) / cast(@b as float)*100 as [cpu]

    go

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply