Profiling with Zend debugger
Besides interactive debugging, PhpStorm integration with Zend Debugger also supports profiling. PhpStorm provides visual representation of profiling data generated by Zend Debugger.
Before profiling with Zend Debugger, download, install and configure the components of the PHP development environment. Normally, these are a PHP engine, a web server, and the Zend Debugger tool.
Enable profiling with Zend debugger
Configure Zend Debugger
Download and install the Zend Debugger tool.
Configure the way to toggle the profiler from the browser
To specify the GET/POST or COOKIE parameters, do one of the following:
Generate the bookmarklets to toggle the debugger through. These bookmarklets will appear on the toolbar of your browser. They provide control over the debugger cookie, through them you will activate and deactivate the debugger.
Enable the Bookmarks toolbar in your browser by doing one of the following depending on the browser type:
In Firefox, choose .
In Chrome, choose .
Open the Xdebug & Zend Debugger bookmarklets generator page, check the debugging engine settings and click Generate. The bookmarks for listed debugging-related actions are generated.
Drag the generated links to the bookmark toolbar in your browser.
Specify the values manually.
Analyze Zend debugger profiling data
When integration with the Zend Debugger profiler is enabled, PhpStorm provides visual representation of profiler snapshots. PhpStorm opens a separate editor tab with four views where the data are presented based on different criteria.
With Zend Debugger, profiling is supported within a zero configuration debugging session.
Initiating a zero configuration Zend Debugger session
Generate the bookmarklets to toggle the debugger through. These bookmarklets will appear on the toolbar of your browser. They provide control over the debugger cookie, through them you will activate and deactivate the debugger.
Enable the Bookmarks toolbar in your browser by doing one of the following depending on the browser type:
In Firefox, choose .
In Chrome, choose .
Open the Xdebug & Zend Debugger bookmarklets generator page, check the debugging engine settings and click Generate. The bookmarks for listed debugging-related actions are generated.
Drag the generated links to the bookmark toolbar in your browser.
Toggle the Start Listen PHP Debug Connections button on the PhpStorm toolbar or status bar so that it changes to . After that PhpStorm starts listening to the port of the debugging engine used in the current project. Debugging ports are set at the PhpStorm level on the PHP | Debug page of the Settings dialog (Ctrl+Alt+S) .
Open the starting page of your application in the browser, choose the Start debugger bookmark to activate the debugging engine from the browser, re-load the current page (the starting page of the application), and then return to PhpStorm.
Establishing a Zero-Configuration debugging session may fail with no breakpoints hit and therefore the script not suspended. This may happen if the path mappings are not configured or configured erroneously, or if you have not set any breakpoints. In the latter case, you can do any of the following:
Set a breakpoint by clicking the gutter at the desired executable line of code. For more information, refer to Breakpoints.
In the Settings dialog (Ctrl+Alt+S) , go to and in the External Connections area, select the Break at first line in PHP scripts checkbox.
Enable the
option from the main menu.
To have PhpStorm display a notification if the script is not suspended, select the Notify if debug session was finished without being paused checkbox in the Advanced Settings area on the page of the Settings dialog.
In the dialog that opens, select the incoming connection to profile and click Accept. The Incoming Connection from Zend Debugger dialog appears only once, when you accept connection from this host for the first time.
PhpStorm presents the collected profiling data in a separate editor tab with the name of the selected profiler output file.
Examine the profiling data
When you request on the accumulated profiling data, PhpStorm opens its visualized presentation in a separate editor tab. The tab is named after the file that implements the page you are currently profiling and consists of several views. Switch between the views to analyze the profiling data based on various criteria of analysis.
Execution Statistics: use this tab to examine the summary information about execution metrics of every called function.
Call Tree: use this tab to explore the execution paths of all called functions.
Callees: use this tab to explore the execution paths of a specific function selected in the Call Tree tab.
Callers: use this tab to explore all the paths that can result in calling a specific function selected in the Call Tree tab.
Metric name | Description |
---|---|
Time | The amount of time (in percent) spent in the selected function and all the functions that are recalled from this function. |
Own time | The amount of time (in percent) spent in the selected function, discounting the amount of time spent in the functions that are recalled from this function. |
Memory (B) | The amount of memory (in bytes) consumed by the selected function and all the functions that are recalled from this function. |
Own memory (B) | The amount of memory (in bytes) consumed by the selected function, discounting the amount of memory consumed by the functions that are recalled from this function. |
Calls | The number of times the selected function was called. |