Profiling PHP Overview

PHP code profiling allows you to inspect how much time and how many calls were made to every single function in the code.

Requirements

Similarly to debugging requirements, profiling requires a local installation of PHP with Xdebug extension.

Profiling Tool Window

Open PHP Profiling Tool Window in Debug / Open PHP Profiler menu.

open the PHP profiling tool window

The PHP Profiling tool window lets you start a PHP profiling session, inspect requests, and open profiling results in a separate Profiler View.

php profiler tool window

  • Choose Launch Setting, if you have a PHP project opened.
  • Specify PHP executable to run.
  • Customize Arguments for the php.exe. By default, it's "-S localhost:8000 -t ." which starts a development server on http://localhost:8000.
  • Click Start Profiling to launch php.exe with the specified arguments.
  • In your browser, open http://localhost:8000/ (by default) to collect profiling data. Each finished request is listed in the tool window with brief information. To display details, click View.
  • Click Stop.

Inspecting Profiling Data

Open details by clicking on View. This will open Profiler View with collected data.

view PHP profiling data

Opening Existing Profiling Results

In case the user has an existing profiling file (CacheGrind format, either uncompressed, or gz compressed), the file can be opened by drag&drop onto the Profiling Tool Window.

Profiling PHPUnit Test

See Profiling PHPUnit Tests for details.

See also