Skip to content

Instantly share code, notes, and snippets.

@benbowler
Last active February 21, 2017 16:53
Show Gist options
  • Save benbowler/51147d55190f89d11045a342e75cc3f0 to your computer and use it in GitHub Desktop.
Save benbowler/51147d55190f89d11045a342e75cc3f0 to your computer and use it in GitHub Desktop.
Enabling Xdebug on Vagrant and Profiling on Qcachegrind for Mac

To test the performance of the importer plugin I enabled Xdebug which is included in Vagrant's install of PHP. All you have to do to enable it is add the following lines to the php.ini file. Which is either etc/php/5.6/cli/php.ini for command line or etc/php/5.6/fpm for nginx. If enabling for nginx you need to restart nginx and php-fpm for it to take effect.

[xdebug]
xdebug.remote_autostart=1
xdebug.profiler_enable=1
xdebug.profiler_append=0
xdebug.profiler_output_dir ="/vagrant/web/app/plugins/agreable-catfish-importer-plugin/testing"
xdebug.profiler_output_name = "callgrind.out.%t-%s"
; For extra points you can also link xdebug with Atom, Sublime Text or NetBeans IDEs
;xdebug.remote_connect_back=0
;xdebug.remote_mode=req
;xdebug.remote_enable=on
;xdebug.remote_host=10.0.2.2
;xdebug.remote_port=9999
;xdebug.remote_log=/vagrant/web/app/plugins/agreable-catfish-importer-plugin/testing/xdebug.log

You can update where the cachegrind logs are stored by updating the xdebug.profiler_output_dir variable.

Finally to view the performance profiler install an application called qcachegrind using brew brew install qcachegrind and open the app by running qcachegrind in the terminal and open the callgrind file using the open menu in qcachegrind.

qcachegrind in action

Don't try and open the cachegrind files in a text editor. They are very large.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment