55.4. Profiling Tools

Profiling tools will allow you to detect and correct performance and memory issues in your projects. The Profiler has two ways of getting its information. Sampling will periodically interrupt the application to capture its current state, and instrumentation will insert additional lines of codes to the selected assemblies. Instrumentation is more accurate but has more overhead than sampling.

The easiest way to start is by launching the Performance wizard from the Analyze menu. You need to select a project, executable, DLL, or web site to profile. Next you select the profiling type (sampling or instrumentation); you can start with sampling and change it later if you need to get more accurate results on a particular area. With that information, the Profiler wizard creates a performance session and opens the Performance Explorer window. You could also create a blank session from the Performance Explorer or from a test in the Test Results window.

In the Performance Explorer (Figure 55-3) you can change between instrumentation and sampling. Using the combo box, you could start the wizard again or manually create a new performance session. You could add targets to the performance session. Although you can instrument or sample a DLL, you need a point of entry for your application to run when you start the session, so be sure to include an executable, web site, or test as target.

Figure 55.3. Figure 55-3

55.4.1. Configuring Profiler Sessions

To configure your ...

Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.