Varying Vagrant Vagrants provides a setup of WordPress that is ripe for you to start profiling the PHP WordPress and your themes and plugins runs. The combination of xdebug, Webgrind, and a simple chrome extension will have you looking at the PHP performance. Let’s take a look at what you’ll need to get going.
To start, you’ll want to clone the Varying Vagrant Vagrants (VVV) git repository if you don’t have it already. VVV comes with xdebug ready for you to turn on and Webgrind for you to view the xdebug output.
Once you have VVV installed, the next step is to enable the profiler. You have a couple of options for this. You can turn it on for all page views (which slows page views down considerably), or you can just enable it in “trigger” mode, when you pass a get/post parameter or have a specific cookie set. I like this option since it enables me to easily switch between profiling and not profiling. I also make use of the Xdebug Helper chrome plugin to turn the cookie on and off. It’s also enabled by default in VVV, so you don’t need to do any work. You do need to turn xdebug on, but that is as easy as connecting to your vagrant box and running [bash]xdebug_on[/bash].
Now that we are setup, we can turn on profiling in our browser.
That’s all it takes to start generating the profiling information. You’ll need to do this for each site you want to be generating profiling data. You can also select disable at any time to turn off profiling. Once it’s on for one of our VVV sites, head over to webgrind at http://vvv.dev/webgrind/ and you’ll be able to start seeing your data.
When you first load webgrind, it’s going to look kind of empty.
After you select a profile file (from the dropdown with “Auto (newest)” pre selected) and click “update”, you will see your profiling information.
And that is all it takes to get started with profiling on Varying Vagrant Vagrants with xdebug and webgrind. Happy Profiling.