How to profile with the PHP Xdebug Profiler

Card Puncher Data Processing

About

The profiler in Xdebug outputs profiling information in the form of a cachegrind compatible file.

Steps

Xdebug installed and configured

Install xdebug and set the profiler php.ini configuration file

Open devtool

Open your browser devtool on the network tab. It allows to get back later the name of the file where the profiling data are saved.

Enable Profiling via the Xdebug Browser Extension

Start the debugger with profiler enable. Starting The Debugger

With a How to install Php Xdebug ?, enable profiling

Firefox Easy Xdebug Profile Cookie

Start. navigate, refresh your page

Execute the HTTP request with your browser by:

  • navigating
  • or refreshing your page (f5)

Retrieve the profiling file name from devtool

On the devtool, in the response header, you should see the x-xdebug-profile-filename'header.

This header holds the location of the profiling file, copy it.

X Xdebug Profile Filename Devtool

Analyze with a Xdebug compatible profiling tool

kcachegrind

The format cachegrind can be read by kcachegrind :

Qcachegrind

Intellij

  • Intellij 1) > Tools | Analyze Xdebug Profiler Snapshot.

Xdebug Profiler Data

and you will see:

Xdebug Intellij Profile Data





Discover More
Xdebug Phpinfo
How to install Php Xdebug ?

Xdebug is a php debugger and profiler. This article show you how to install and configure xdebug on your system. You can install xdebug with one of the following possibilities Go to the wizard...



Share this page:
Follow us:
Task Runner