Reputation:
I want to use Xdebug to profile a single php file. From Xdebug documentation, it is said
Profiling is enabled by setting the xdebug.profiler_enable setting to 1 in php.ini. This instructs Xdebug to start writing profiling information into the dump directory configured with the xdebug.profiler_output_dir directive.
I tried but Xdebug will generate so many profile logs. I have no testing environment but only could use production server. I want to know is there any way to set just testing one page?
Any suggestions to do this?
---Update 02/11/2013---------------------------
Finally I choose facebook / xhprof as my production server profiler. I use xhprof_html everyday now. It save a lot of time and very easy to use, especially the Full Callgraph view.
Upvotes: 4
Views: 3433
Reputation: 34837
There is another option in the xdebug configuration that will do this: xdebug.profiler_enable_trigger
. Set it to 1 and then open the URL you want to profile with a querystring suffix of ?XDEBUG_PROFILE
. It will then write a log just for that script.
Upvotes: 2
Reputation: 32155
Use the trigger http://xdebug.org/docs/all_settings#profiler_enable_trigger and add it to your url. i.e. http://example.com/mypage.php?XDEBUG_PROFILE=1
Also, XHProf is preferred over XDebug when profiling on production: https://github.com/facebook/xhprof
Upvotes: 2