When your program encounters performance problems, such as slow response of IIS requests, slow execution of client programs, what is the problem with the analysis? Dottrace helps the. NET program track the execution time of each method in the code, so that we can see more clearly where the execution takes too long, and then analyze how it should be resolved.
Dottrace is a product developed by jetbrainshttp://www.jetbrains.com/Company, it dottrace performance and Dottrace Memory two tools, Dottrace Performance is used to analyze code performance, such as function execution time, number of calls, elapsed time ratio, and so on, dottrace memory is typically used to analyze the footprint. Dottrace can track. NET Writing: Applications, IIS-hooked programs, Windows services, SILVERLIGHT,WCF services, and so on. You can also save tracked files to a snapshot and save them as a DTP suffix file. After the tracking results, if you can find the corresponding user's code information, you can also directly view the corresponding source code, and choose to directly edit the method corresponding file in vs.
The following is an example of a tracking client program:
1. Select the type of program you want to track:
Because it is a client program, here we choose Standalone application.
2. Select the executable path and parameters and configure the tracking method:
For example, application, arguments corresponds to the path of the executable program and the required parameters respectively.
There are three types of profiling type:
- Tracing: It is the parse time that is computed by acquiring a method within the CLR that starts execution and ends execution.
- Line-by-line: It is time to collect each statement executed by the code, and it calculates the time more precisely.
- Sampling: It's a sampling method, every once in a while (about 10ms under Windows), pausing all the threads, grabbing the information in the stack, and then calculating the time lag of the code execution, which can cause some problems that are not captured by a very short method.
Three types of measure:
- Wall Time (performance counter): It is a collection of information through the performance counter API that the general operating system and individual hardware devices provide performance metering APIs for program invocation.
- Thread time: It only supports sampling parsing, which fetches the stack information computation time through a fixed thread, and it only calculates the time of its own internal program execution, regardless of the time it waits for another IO.
- Wall time (CPU instruction): It is calculated by reading the methods recorded in the TSC processor register to enter and exit the time difference.
According to the above options, generally we want to fully analyze the execution time of our program, we recommend that you can use Line-byline (or tracing) and wall (CPU instruction) or wall times (performance counter ), because if you use sampling and thread time collocation, you will only calculate your own internal times, and you will not be able to calculate the time of your program and external program interaction, which can mislead you when analyzing performance.
3. Run the tracker after clicking Run
Then clicking on Get snapshot will generate a snapshot of the call stack executed by the program, with the execution time we are most concerned about.
4. Is the result of the build:
Five views of the corresponding result in the red box on the left:
- Overview: This can be seen in the performance analysis file fetching method, such as the above example is Line-by-line,wall time (CPU instruction) way, crawl URL address, etc. There is also information such as the system configuration under the view and the current module and number of methods.
- Threads Tree: Records the methods currently executed by each thread, as well as the performance of the method.
- Call Tree: Regardless of the thread, the entry for all requests is presented as a piece of data, but the sort shown in it is sorted by execution time, not in code order.
- Plain list: Shows a listing of all non-kernel code methods and shows the execution time and number of calls for each method.
- Hot spots: It takes all the code, including the kernel code, into the list in the order of execution time, and records information such as the execution time ratio and time of each method.
is shown in the Threads tree view, where we see the main thread and the execution time of multiple managed threads and the time each method executes, so that we can easily locate the bottleneck of the program. Dottrace more should be applied to the IIS Web site performance analysis, which also enables code debugging to parse the. NET framework and the statement-level code coverage of Silverlight applications. The ReSharper unit Test toolset is integrated, highlighting code that is not covered by the unit tests, detecting unit tests that overwrite any particular code location, and generating XML-based code coverage reports.
For more Dottrace introduction, please click here.
Tracking code execution time using Dottrace