HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/plateau.komma.nl/vendor/phpbench/phpbench/docs/extensions/xdebug.rst
Xdebug
======

The Xdebug extension allows you to easily profile your code.

Installation
------------

The XDebug extension is enabled by default.

Generate a profile (cachegrind)
-------------------------------

The profile command is very similar to the run command:

.. code-block:: bash

    $ phpbench xdebug:profile examples/HashBench.php --progress=none

    3 profile(s) generated:

        profile/_HashingBenchmark::benchMd5.P0.cachegrind
        profile/_HashingBenchmark::benchSha1.P0.cachegrind
        profile/_HashingBenchmark::benchSha256.P0.cachegrind

A single profile is generated for each subject in the benchmark and placed in
the directory ``profile`` by default.

The generated profiles can be viewed with a cachegrind viewer such as
`kcachgrind` (linux) or `webgrind`_ (web based).

.. image:: ../images/profile.png

Automatically launch a GUI
--------------------------

It is possible to automatically launch a GUI for each of the profiles using
the ``--gui`` option. 

By default PHPBench will attempt to locate the ``kcachegrind`` executable. If
you do not have ``kcachegrind`` you can specify a different executable using
the ``--gui-bin`` option.

.. _profiles: http://xdebug.org/docs/profiler
.. _kcachegrind: http://kcachegrind.sourceforge.net/html/Home.html
.. _webgrind: https://github.com/jokkedk/webgrind