zqhong / pelican-blog

Use Pelican generate static blog site
1 stars 0 forks source link

Xdebug 性能分析工具 - profiler #2

Open zqhong opened 7 years ago

zqhong commented 7 years ago

示例配置

xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = /home/vagrant/Code/tmp/xdebug
xdebug.profiler_output_name = trace.%s

如何使用(官方文档)

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_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