Visit the url with XDEBUG_PROFILE param, such as http://www.example.com/?XDEBUG_PROFILE=true, XDebug will output tmp file to the path /tmp/xdebug. Then visualize those with an external tool such as KCacheGrind or WinCacheGrind.
主要
xdebug profiler output dir MUST exists.
You MUST visit the url with XDEBUG_PROFILE param.
配置细节
xdebug.profiler_enable
Type: integer, Default value: 0
Enables Xdebug's profiler which creates files in the profile output directory. Those files can be read by KCacheGrind to visualize your data. This setting can not be set in your script with ini_set(). If you want to selectively enable the profiler, please set xdebug.profiler_enable_trigger to 1 instead of using this setting.
xdebug.profiler_enable_trigger
Type: integer, Default value: 0
When this setting is set to 1, you can trigger the generation of profiler files by using the XDEBUG_PROFILE GET/POST parameter, or set a cookie with the name XDEBUG_PROFILE. This will then write the profiler data to defined directory. In order to prevent the profiler to generate profile files for each request, you need to set xdebug.profiler_enable to 0. Access to the trigger itself can be configured through xdebug.profiler_enable_trigger_value.
xdebug.profiler_output_dir
Type: string, Default value: /tmp
The directory where the profiler output will be written to, make sure that the user who the PHP will be running as has write permissions to that directory. This setting can not be set in your script with ini_set().
示例配置
如何使用(官方文档)
Visit the url with
XDEBUG_PROFILE
param, such ashttp://www.example.com/?XDEBUG_PROFILE=true
, XDebug will output tmp file to the path/tmp/xdebug
. Then visualize those with an external tool such as KCacheGrind or WinCacheGrind.主要
MUST
exists.MUST
visit the url withXDEBUG_PROFILE
param.配置细节
xdebug.profiler_enable
Type: integer, Default value: 0 Enables Xdebug's profiler which creates files in the profile output directory. Those files can be read by KCacheGrind to visualize your data. This setting can not be set in your script with ini_set(). If you want to selectively enable the profiler, please set xdebug.profiler_enable_trigger to 1 instead of using this setting.
xdebug.profiler_enable_trigger
Type: integer, Default value: 0 When this setting is set to 1, you can trigger the generation of profiler files by using the XDEBUG_PROFILE GET/POST parameter, or set a cookie with the name XDEBUG_PROFILE. This will then write the profiler data to defined directory. In order to prevent the profiler to generate profile files for each request, you need to set xdebug.profiler_enable to 0. Access to the trigger itself can be configured through xdebug.profiler_enable_trigger_value.
xdebug.profiler_output_dir
Type: string, Default value: /tmp The directory where the profiler output will be written to, make sure that the user who the PHP will be running as has write permissions to that directory. This setting can not be set in your script with ini_set().
扩展阅读
XDEBUG - Profiler