How do I read the UI of qcachegrind?

馋奶兔 提交于 2020-05-24 13:29:45

问题


I am using qcachegrind to view a Profile log that is created by Xdebug. I can view the file fine, but I have no clue what Im looking at.

I have tried Google but I just keep getting installation tutorials, nothing about how to understand the display.

  1. What does the below qcachegrind display tell me about my application
  2. Is there anything more I can view from this file, or is this all of the available data?

(please open image in new tab for a better view)



回答1:


Tools like qcachegrind and kcachegrind visualise the output of the Xdebug PHP profiler. The output of the profiler is practically a log of all PHP function calls with corresponding start time, execution time and hierarchy.

A typical view is shown in the following figure:

On the left side is the 'Flat Profile'. It lists all individual function calls from most time consuming to least time consuming. The 'Incl.' column shows the time consumed by the function including callees. The 'Self' column shows the time spent by the function excluding callees. The 'Called' and 'Function' columns show respectively the number of times a function is called and the name (plus namespace) of the function.

On the right side, various views are available to visualise callers and callees. The callers and callees correspond to the function selected on the left side.

In my screenshot at the top, the 'Callee Map' is opened. Each rectangle is a function call within the selected function (a callee) and each rectangle within is a callee of the callee. The size corresponds to the relative 'Incl'. time.

At the bottom, the 'All Callees' view shows the callees of the selected function order by whatever property you prefer.

A more detailed view is shown below:

This is a function of a Laravel database function sorted on 'Self' time. You clearly see how the different function calls relate and what function takes up the most time: PDOStatement::execute. This is no surprise as it is a function that connects to an external database, queries it and waits for the result.

Back to your original screenshot: it tells you that your application spent most of time in PHP's session_start function (99.8%).



来源:https://stackoverflow.com/questions/33094913/how-do-i-read-the-ui-of-qcachegrind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!