Guide
Pass the first two articlesArticleYou should have a certain theoretical understanding of aqtime! [Previous] At last, I buried several mines in the demo. I hope you will find them by yourself! Because there are not many feedbacks on mines, I don't know how many people have actually started the experiment. If you want to tell me what you want, I am very pleased! OK, no matter what, this time we are trying to demonstrate the process of mine mining. With aqtime, this super mine detector is actually a very simple and pleasant process. I hope you will enjoy it!
Remember to leave valuable comments !!!Source code download:
First, open aqtime, create a project, and thenJustin. uilibrary. dllLoad it to the modules list, and then selectProfile entire. Net code, Select ASP. NET as the project type, and thenRun ParametersSettingsStart pageYesHttp: // localhost/Justin/default. aspx(Depending on the configuration of the IIS virtual directory in our environment), then we can start mining!
As shown in, there are two problems here (based on [Previous] The Configuration Analysis scope and granularity introduced in this article). First, why is it not set to status at the beginning? Second, why should we use the default Area Profile entire. Net code? The answer to the first question is that we do not know where mines are, so we need to track and analyze them.ProgramThe answer to the second question is that we are not sure whether the loaded module is sufficient, and the specific modules to be loaded, so we first use the default area settings, analyze all modules loaded by the program. We can also think that the answer to these two questions is because we didn't have a clear goal at the beginning, therefore, we can only rely on the stupid method of "spread the network to Fish.
As shown in, when you run it for the first time, the above three windows will pop up successively. You can leave them alone and press enter all, of course, you can also select "don't... "check box, so that they will not pop up again next time.
OK! After the program is executed, we execute "simulated submission", "simulated browsing", and "simulated modification" in sequence. The results are slow. It seems that the performance problem is serious. After all the operations are executed, we collect the performance data in the lifecycle of the program. This can be said to be the most complete analysis data for all operations throughout the lifecycle.
【Big chart]
As shown in, we have gained a lot this time! This is the result of the complete life cycle (excluding page closure) of the demo we collected using aqtime. It also contains all the underlying frameworks (..Aqtimetestjustindemo_01.aqrFile, you can open it through aqtime. The following is based on this result, and began to mine! Let's first introduce the most basic mining skills, that is, to clearly understand the meaning of the following three columns in the grid in the report tab:
These three columns are the three most important columns when we use aqtime to analyze program performance problems. (There are many other columns, which are not practical, but it is not useful at all !), First, if the execution time of a method is too long, the value of the [time] column will be very large. This is also the dumbest mine, because I have clearly told you that, the execution of this method is too long, and it is the bottleneck you are looking for. The rest is to analyze the reason why this method is too long. Can you optimize it? If not, please come back to the experts. Secondly, if a method calls many sub-methods and its [time with children] column has a large value, the [call tree] or [Call Graph] tab is used to find the sub-method where the bottleneck occurs, generally, you can use the [call tree] to easily locate the most time-consuming sub-methods. aqtime will automatically show the most time-consuming nodes in bold, which can be very clear. Finally, if the value of a [hitcount] column is very large, you must be vigilant. problems may occur, if the method hitcount of the underlying base class is relatively high, it is relatively easy to accept. If it is a custom method that is relatively front-end, check the program logic, whether it is as expected It is entirely possible to execute multiple cycles.
Based on the basic mining techniques described above, for example, this is the result of inverted sorting by [time with children]. From top to bottom, we can find that,_ Default: page_loadThe previous results were from the underlying framework itself, which was not within our scope of mine clearance, because we began to collect performance data using the stupid method of "spreading the Internet to multiple fish, therefore, when analyzing the results, you need to separate and filter out the underlying framework methods by yourself. So here we will focus on why_ Default: page_loadThis method takes the longest time. We use the [call tree] to expand its sub-method to see where the bottleneck is:
As shown in, we can see through [call tree] that the most time-consuming isFormloadutils: loaduiAnd_ Default: initdataTwo methods, and these two methods are very large in [time], so they are all silly mines (I have tracked them all this time), OK! Now that the mine has been accurately located, we should check what is in the mine. Can we take a minor operation to remove the mine?
Through the editor tab, we can directly viewSource codeAnd the content on the editor tab is still dynamically synchronized with grid. Cool! It's so convenient! As shown in, we can clearly see that in the loadui method, the last sentence is:"System. Threading. thread. Sleep (3000 );", Yes, it is mine 2. We found it! Haha!
Likewise, as shown in figure, we can easily find mine 3, which has three seconds of destructive power!
Oh, yes! We have found both mine 2 and mine 3. Now I can reveal that I have actually buried three mines, so we have not found mine 1 yet! According to the above method, carefully analyze the grid list and use the [call tree] method to quickly find mine 1. We will not introduce this. What I want to say is that, in fact, smart people should have thought that mine 1 must also be dummies, but for Dummies, the best way is to reverse the grid by [time] At the beginning, so that the location of the silly mine can be directly exposed!
As expected,Ui: initpageIt is clearly exposed. Yes, it is mine 1. You can see through the editor that it is also a 3-second dumb Ray! Haha!
So far, all our mines have been dug up. Well, at least I have dug up all the intentionally buried mines, and I don't know if there is any more! So someone must be smart enough to ask, why don't we use [time] in reverse la s? This is a good question. In this article, the author used the [time with children] inverted way to demonstrate the magical power of grid and [call tree, in fact, this method is often used in the process of optimizing program performance, because there are few silly mines to be dug. However, I want to emphasize that, at any time, we suggest that you follow the"[Time] first and then [time with children] Last [hitcount]This is the most reasonable and efficient combination. For example, you can use this method in this demo to analyze the problem once [time] in reverse order!
Finally, I would like to add a bit more about the stupid method we used above for "fishing for fish via the Internet". This method is very useful in this demo, because our demo is relatively small after all, therefore, the execution speed is also relatively fast, and the data collected will not be too scary. However, when analyzing large projects, in general, it is best to analyze the specific function points in a certain part of the lifecycle. In this case, we need to explicitly load those modules and then narrow the scope of mine clearance, to help you locate the bottleneck more quickly and accurately, refer to [previous] for details. In this demo, as described in [Article 1], to collect performance data for all our custom programsJustin. uilibrary. dllIn addition, we need to load the DLL of the class corresponding to the aspx file dynamically generated by ISAPI. For details, refer to the first article. Here we will re-configure the modules of aqtime, collect data again.
As shown in, this time we loaded the necessary module, and then set it to the "full check" option in area to track and analyze only the module in the modules list.
【Big chart]
As shown in, the collected results are much clearer than the previous one (corresponding toAqtimetestjustindemo_02.aqrFile), and does not contain any underlying framework method. All collected data is within the module range in the modules list, so that we can analyze and locate the problem, you don't need to separate and filter out the underlying framework as you did above. Isn't that refreshing! The advantages of the Configuration Analysis scope are not obvious in this demo, because the full lifecycle analysis has not much data in this demo, but after aqtime is attached to a large project, click "save" for an application that will wait for half an hour. It is critical to control the scope of the analysis from the very beginning. Otherwise, a lot of "garbage" will be collected, the most frightening thing is that it is possible that nothing has been collected after half a day, why ?! : Kao! Dead!
In conclusion, this article describes in detail the process of using aqtime in general, combined with the first two articles, I believe that you should be able to use aqtime to skillfully solve some performance analysis problems now! If you have any questions, leave a message here and I will try my best to answer them. I may write another article about aqtime in this series. The content is some aqtime tips, which is a summary of the practical experience.
-Welcome to the blog Park. debug exploration team copyright Justin.