Sometime ago we announced integration with Xdebug profiler in PhpStorm 3.0. This time we want to introduce you integration with another popular CPU profiling extension for PHP – Zend Debugger.
The set of views which PhpStorm builds by analyzing a Zend Debugger profiler snapshot is the same as for the Xdebug profiler:
- ‘Execution Statistics’ – displays summary information about execution metrics for every called function/method.
- ‘Call Tree’ – displays the execution paths of the called functions.
- ‘Callees’ – same as ‘Call Tree’ but with the selected function as the root.
- ‘Callers’ – all the paths that can result in calling the selected function.
In order to start a profiling session you need to install and configure the Zend Debugger extension. If you have already configured Zend Debugger for debugging, use this configuration for profiling. Alternatively, follow the Zend Debugger installation guide.
Next, you need to enable Zend Debugger to start capturing profiling snapshots on the required web pages. Just like during a debugging session, you need special cookies set in your web browser. You can do it manually, but it would be handier to use our browser bookmarklets which will set all the necessary cookies for you.
Let’t start profiling with Zend Debugger and browser bookmarklets
- Open IDE
- Enable listening for incoming connections from Zend Debugger
- Open browser and navigate to the web page you want to profile
- Click the ‘zend Start Profiler’ bookmark
- Refresh the page
- Switch to the IDE and accept the incoming connection from Zend Debugger (this dialog will appear only once, if you have never accepted connections from this host before)
- Let’s start hunting for bottlenecks in your code!
- After you have finished your profiling session, click the ‘zend Stop profiler’bookmark to stop capturing profiling snapshots (it will remove the cookie which triggers profiling)
PhpStorm 3.0 download is available on official download page.
Develop with pleasure!