Section 17.7. Benchmarking and Profiling

17.7. 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 17-27, which tested the relative speed of string concatenation techniques, is an example of a simple benchmarking program. Obviously, benchmarking programs will often be 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 the following:

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

  • The .NET performance counters API

The Performance Monitor can be used to watch a huge variety of system parameters, both .NET-specific and otherwise , in real time. You can open the Performance Monitor by going to Start Settings ControlPanel Administrative Tools Performance, or you can do this by opening a Command Prompt and entering perfmon . When the Performance 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 reading existing performance counters and for creating and writing to custom counters.

Benchmarking is a vast subject and this section only scratches the surface. Many articles and books have been written on the subject. To see what support is available within the .NET Framework, search for Monitoring Performance in the documentation index.




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

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