The CLR fully introduces:. NET's internal diagnostics tool

Source: Internet
Author: User
Tags garbage collection

Many diagnostics tools require the use of the CLR profiling API, even those that are not strictly profiler-critical. So, if you ever wanted to know how these tools work, then understanding the analysis of the API would be a good start. In this column, you'll see how they work, and learn some helpful tips and tricks. You will also find some basic resources in the "Other Analysis resources" sidebar.

To use the CLR profiling API, you need to use an unmanaged language (usually C + +) to create the DLL, and then set some environment variables to instruct the common language runtime (CLR) to load the DLL and allow it to use the profiling API. When this DLL is loaded, it actually becomes an extension of the CLR itself to receive callbacks, request information, and make deep changes to the CLR's execution. The profiling API can notify many of the activities that occur in the CLR and managed code, including AppDomains creation and destructor, assembly loading and unloading, JIT-compiling functions, executing functions, throwing and catching exceptions, and garbage collection. Using the profiling API, you can get information about the parts of your application, such as the name and location of the assembly, the description of the type and function, and the location and distribution of the object in memory. Finally, you can use the profiling API to modify settings, descriptions, and similar information, including disabling optimizations in the JIT compiler, changing the intermediate language (IL) of functions, and even creating new types and functions.

As you will see, these features can be combined to power many diagnostics tools.

Performance Profiler

A performance profiler is a diagnostic tool that shows how your application utilizes time. If some of the operations in the application are running too slowly, the profiler can identify where the problem is, so that the tuning effort is concentrated in the appropriate place.

There are two main categories of performance Profiler: Tracking and sampling. The basic task of the trace profiler is to record in the log the time it takes to call or return each function when the application is running. From this log, the profiler can know how the control flow moves through the entire application, as well as the cost of the time. In the Visual studio®2005 Performance tool, select Detect from the Performance Wizard to specify the trace profiler (see Figure 1).

Figure 1 Performance analysis in Visual Studio 2005

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.