Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP xDebug graph interpretation

I am profiling a PHP application (built upon the Zend framework). Attached you can find a screenshot of the main call graph that KCacheGrind produces from xDebug output.

There are two things that I don't understand:

1) Why does {main} "fork" into 2 calls? Are they supposed to be parallel somehow or does one happen after the other?

2) The arrow to the left of {main} has a little blue bar with the text 2x; does this mean that the call to Zend_Application->bootstrap happened twice?

 

PHP xDebug graph

like image 344
thwd Avatar asked Apr 16 '12 12:04

thwd


People also ask

How does PHP Xdebug work?

When Xdebug is running, it will call back to your IDE (like PhpStorm or VS Code) from the server where it's running. Your IDE will sit and listen for that connection on a specific port (typically port 9000 or 9003).

What is Xdebug profiling?

Introduction # Xdebug's Profiler is a powerful tool that gives you the ability to analyse your PHP code and determine bottlenecks or generally see which parts of your code are slow and could use a speed boost.

What is Xdebug trace?

Xdebug allows you to log all function calls, including parameters and return values to a file in different formats. Those so-called "function traces" can be a help for when you are new to an application or when you are trying to figure out what exactly is going on when your application is running.


1 Answers

  1. The calls (of course) happen after each other. The graph splits because each of the top two functions are called by main(). The graph shows calls, not execution order.

  2. Yes, that's exactly what it means. main() called Zend_Application->bootstrap twice and ->run once.

like image 104
Derick Avatar answered Oct 22 '22 12:10

Derick