监控应用程序的性能的一个很好的办法就是使用Performance Counter。Windows提供了系统工具来显示PerformanceCounter收集的数据,在运行对话框中输入perfmon,就可以调出该工具来显示PerformanceCounter收集的数据。如果在工具中添加一个Performance Counter,就会发现,每一个Performance Counter都会属于一个目录,以便于组织Performance Counter。每一个目录下都有许多个Performance Counter,每一个Performance Counter又会有很多实例,例如:在Process目录下,有很多Performance Counter,其中一个是%ProcessTime,表示CPU占用时间的Performance Counter,选择此Performance Counter,又会看到很多实例,每个实例的名字就是进程的名字,选择一个实例,就可以看到指定进程占用CPU时间的Performance Counter数据。有时候你会发现选择一个Performance Counter后并没有与之相关的任何实例,这表示该Performance Counter只能有一个实例。
监控应用程序的性能的一个很好的办法就是使用Performance Counter。Window