Performance Counter是windows系统中通用的性能分析工具。Windows OS和SQL Server暴露了很多Performance Counter,可用户分析整个系统的运行情况。performance counter结合等待事件一起使用,能取得更好的优化效果。
在这篇文章中,我们将介绍:
1、如何使用工具查看performance counter
2、sql server常用的performance counter
3、windows常用的performance counter
很多工具可以用来查看和分析performance counter,常用的方法:
使用perfmon程序
使用resmon程序
使用typeperf命令行工具
使用SQL Server Performance Counter DMV
perfmon是windows下查看性能计数器的首选工具。我们可以使用perfmon
1、查看当前性能计数器
2、将性能计数器的数据采集下来,供后续分析
SQL Server的Performance Counter也可以通过 sys.dm_os_performance_counters视图查询。
便于监控程序以SQL语句的方式获取指标:
select * from sys.dm_os_performance_counters
关键字段:
object_name: 计数器的类别。
counter_name:计数器名称
instance_name:实例名称。如数据库
cntr_value: 计数器的值
cntr_type:计数器类型。计数器类型对于指标计算非常关键,不同的类型需要使用不同的公式计算