sys.dm_os_performance_counters

  • Looking at Logins/Sec it has cntr_value of 1660045. There is no way that is correct, we do not even have that many users. It also shows that we had 32359 logout/sec and this seems high too.

    The user connections might be correct, at 52.

    Anyone know why the I am getting so many logins/sec and logout/sec in this DMV?

  • Those numbers are cumulative since SQL was last started. In order to get the actual numbers for a specific time period you will need to use a delta. I use a temp table that captures the values from the previous query of the DMV, use that to subtract from the current run, insert the difference into the a tracking table and then replace the values in the temp table with the values I just gathered from the latest pull.

  • Thanks... being a counter since reboot.. the term /sec is worthless then. Thanks for the help and the work around!

  • dwilliscp (10/25/2012)


    Thanks... being a counter since reboot.. the term /sec is worthless then. Thanks for the help and the work around!

    I just use variables for the per/second counters

    declare @v1 bigint, @v2 bigint

    select @v1 = cntr_value from master.sys.dm_os_performance_counters

    where counter_name='Batch Requests/sec'

    waitfor delay '00:00:01'

    select @v2 = cntr_value from master.sys.dm_os_performance_counters

    where counter_name='Batch Requests/sec'

    select @v2 - @v1

    --------------------------------------------------------------------------------

Viewing 4 posts - 1 through 3 (of 3 total)

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