Created
December 7, 2011 13:37
-
-
Save justinpitts/1442834 to your computer and use it in GitHub Desktop.
perf counters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @PERF_AVERAGE_BULK INT , | |
@PERF_LARGE_RAW_BASE INT | |
SELECT @PERF_AVERAGE_BULK = 1073874176 , | |
@PERF_LARGE_RAW_BASE = 1073939712 | |
SELECT dopc_avgBulk.object_name , | |
dopc_avgBulk.instance_name , | |
dopc_avgBulk.counter_name , | |
CAST(dopc_avgBulk.cntr_value AS FLOAT) | |
--when divisor is 0, return NULL to indicate | |
--divide by 0 | |
/ CAST(CASE dopc_base.cntr_value | |
WHEN 0 THEN NULL | |
ELSE dopc_base.cntr_value | |
END AS FLOAT) AS cntr_value | |
FROM sys.dm_os_performance_counters dopc_base | |
JOIN sys.dm_os_performance_counters dopc_avgBulk | |
ON dopc_base.cntr_type = @PERF_LARGE_RAW_BASE | |
AND dopc_avgBulk.cntr_type = @PERF_AVERAGE_BULK | |
AND dopc_base.object_name = dopc_avgBulk.object_name | |
AND dopc_base.instance_name = dopc_avgBulk.instance_name | |
--Average Wait Time has (ms) in name, | |
--so it has handled "special" | |
AND ( REPLACE(dopc_base.counter_name, | |
'base', '') = dopc_avgBulk.counter_name | |
OR REPLACE(dopc_base.counter_name, | |
'base', '') = REPLACE(dopc_avgBulk.counter_name, | |
'(ms)', '') | |
) | |
ORDER BY dopc_avgBulk.object_name , | |
dopc_avgBulk.instance_name , | |
dopc_avgBulk.counter_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment