Share via


Measuring Target Method Performance

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

The Policy Injection Application Block contains instrumentation that allows developers, administrators, and operators to monitor the performance of the application block itself. In most cases, developers will also include instrumentation, such as performance counters, within their code to support monitoring of the operation of target classes used by the application.

The Policy Injection Application Block provides additional and easy-to-use features for monitoring performance of target classes in the form of a handler that measures the time taken for the request to pass through the handler pipeline to the target class instance, and back to the application. One such feature is part of the Logging Handler; it requires only the addition of this handler as the first in the policy pipeline. The Logging Handler takes advantage of the features exposed by the Enterprise Library Logging Application Block, and it exposes the call duration as a property of the TraceLogEntry class defined within the Policy Injection Application Block.

For more details about how the CallTime property exposed by the Logging Handler can provide performance measurement for individual methods, see The Logging Handler in the section Configuring and Using Pipeline Handlers.

Another option for measuring the performance of the target methods is to use the Performance Counters Handler. This handler increments a number of performance counters that provide detailed performance information, including the average execution time for the method and the number of times the method is called. For more information, see The Performance Counter Handler in the section Configuring and Using Pipeline Handlers.