PHP - Profiler (With Xdebug)
Table of Contents
1 - About
The profiler in Xdebug 2 outputs profiling information in the form of a cachegrind compatible file.
2 - Prerequisites
3 - Configuration
3.1 - Php
- Open the active php.ini file.
- Set the xdebug.profiler_enable directive to 1:
xdebug.profiler_enable = 1;
- To enable toggling the profiler from the browser through control over debugger cookies, set the xdebug.profiler_enable_trigger directive to 1:
xdebug.profiler_enable_trigger = 1;
- Define location for accumulating profiling snapshots by specifying the xdebug.profiler_output_dir directive.
xdebug.profiler_output_dir = "<output folder name>"
- Specify the name of the file to store snapshots in through the value of the xdebug.profiler_output_name directive.
xdebug.profiler_output_name = "cachegrind.out.%t-%s" ; default: cachegrind.out.%p where %p is the name format specifier
The name should always be cachegrind.out with a supported format specifiers ??? Why not callgrind.what_youw_want.
Advertising
3.2 - Browser
Start the debugger with profiler enable. Starting The Debugger
With Firefox, you can use this plugin = Firefox the easiest xdebug
3.3 - Analyze
3.3.1 - kcachegrind
The format cachegrind can be read by kcachegrind :
- Linux: The KCacheGrind
- Windows: QCacheGrind (QCacheGrind is KCacheGrind without KDE bindings)
3.3.2 - Intellij
Advertising