18.6 Benchmarking and Profiling

Benchmarking is the process of conducting reproducible performance tests to see how fast an application is running. It may involve coding the same task two different ways and seeing which one runs faster. The web page shown previously in Example 18-23, which tested the relative speed of string concatenation techniques, is an example of a simple benchmarking program. Obviously, benchmarking programs will often be much more complex than that example. They should be designed to emulate your environment as closely as possible.

Profiling is the gathering of performance information about an application. There are several ways to profile an application. Two that are part of the .NET Framework are:

  • Windows NT, Windows 2000, and Windows XP System Performance Monitor

  • The .NET performance counters API

The System Monitor can be used to watch a huge variety of system parameters, both .NET-specific and otherwise, in real time. You can open the System Monitor by going to Start\Settings\ControlPanel\AdministrativeTools\Performance, or by opening a Command Prompt and entering perfmon. When the System Monitor opens, click on the Add icon on the toolbar to select and add any number of performance counters. The available counters cover the processor, memory, hard disk, SQL Server, .NET, and ASP.NET.

The performance counter's API includes several classes. The PerformanceCounter component in the System.Diagnostics namespace can be used for both reading existing performance counters and for creating and writing to custom counters.



Programming ASP. NET
Programming ASP.NET 3.5
ISBN: 0596529562
EAN: 2147483647
Year: 2003
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net