![]() | ||
![]() |
In this chapter we have examined the facilities that both Windows and the CLR make available for you to monitor the performance of managed applications and track down bottlenecks that can be impairing performance.
The underlying tools for this purpose fall into two main categories: performance counters and the profiling API. Performance counters are designed to monitor the resource usage of an application, for example they can indicate if memory usage is excessive or if an excessive number of exceptions are being thrown. The Profiling API can be used to drill down more specifically into the execution flow of a program, measuring what objects are being instantiated and how long the computer is spending executing various methods. There are a number of utilities around that present the information from performance counters in a convenient format, and we've also shown how to access performance counters programmatically from managed code. In the case of profiling, the API is complex and you won't normally access it programmatically. It's more usual to purchase a commercial profiler - we've used one such profiler to demonstrate the general principles of how to use this kind of tool and what information can be extracted from it.
![]() | ||