October 4, 2012 at 8:09 am
Hi All
I'm having a hard time working with the sys.dm_os_performance_counters DMV
For per/second counters, how can I query the DMV to get an accurate per/second figure?
Thanks
October 4, 2012 at 8:15 am
Uou need to capture then 1 second apart then minus the figures, as the counter value is cumulative.
October 4, 2012 at 8:26 am
Depending upon what kind of problem you are facing you need to set your own counter.
Below query may help you whic is for buffer cache hit ratio ,you need to change it as per your requirement
SELECT (CAST(SUM(CASE LTRIM(RTRIM(counter_name)) WHEN 'Buffer cache hit ratio'
THEN CAST(cntr_value AS INTEGER) ELSE NULL END) AS FLOAT) / CAST(SUM(CASE LTRIM(RTRIM(counter_name))
WHEN 'Buffer cache hit ratio base' THEN CAST(cntr_value AS INTEGER) ELSE NULL END) AS FLOAT)) * 100
AS BufferCacheHitRatio FROM sys.dm_os_performance_counters WHERE
LTRIM(RTRIM([object_name])) LIKE '%:Buffer Manager' AND [counter_name] LIKE 'Buffer Cache Hit Ratio%'
October 5, 2012 at 12:12 am
anthony.green (10/4/2012)
Uou need to capture then 1 second apart then minus the figures, as the counter value is cumulative.
Thanks
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply