PhpStorm 9.0.0 Help

Enabling Profiling with Zend DebuggerTesting PHP Applications

Analyzing 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.

To have the profiling data collected and analyze it, perform these general steps:

Initiating a Zero Configuration Zend Debugger Session

  1. 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.
    1. Enable the Bookmarks toolbar in your browser by doing one of the following depending on the browser type:
      • In Firefox, choose View | Toolbar | Bookmarks Toolbar.
      • In Chrome, choose Bookmarks | Show bookmarks bar.
    2. Open the Settings dialog box by choosing File | Settings and expand the Languages & Frameworks node. Then click Debug under PHP.
    3. On the Debug page, that opens, click the Use debugger bookmarklets to initiate debugger from your favorite browser link.
    4. On the Zend Debugger & Xdebug bookmarklets page that opens, check the debugging engine settings and click Generate. The bookmarks for listed debugging-related actions are generated.
    5. Drag the generated links to the bookmark toolbar in your browser.
  2. Toggle the Start Listen PHP Debug Connections button start_listening_php_debug_connections.png so it changes to stop_listening_php_debug_connections.png. After that PhpStorm starts listening to the port of the debugging engine used in the current project. Ports for debuggers are set at the PhpStorm level in the Debug dialog box (File | Settings | PHP | Debug ).
  3. 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 if the path mappings are not configured or configured erroneously, or if you have not set any breakpoints. In the latter case, enabling the Run | Break at First Line in PHP Scripts option on the main menu may also help.

    To have PhpStorm display a notification if the script is not suspended, select the Notify if debug session was finished without being stopped check box in the Advanced Settings area on the Debug page of the Settings dialog box.

  4. In the dialog box, that opens, select the incoming connection to profile and click Accept. The Incoming Connection from Zend Debugger dialog box 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.

Examining 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.

  • In the Execution Statistics view, examine the summary information about execution metrics of every called function.
  • In the Call Tree view, explore the execution paths of all called functions.
  • To explore the execution paths of a specific function, select the function in question in the Call Tree view and view its callees in the Callees view.
  • To explore all the paths that can result in calling a specific function, select the function in question in the Call Tree view and examine its possible callers in the Callers view.

See Also

Last modified: 25 July 2015