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.

In the browser bar, you'll find a nice bug.  If you click that, you'll see a simple menu.
In the browser bar, you’ll find a nice bug. If you click that, you’ll see a simple menu.

By default, disabled is selected.  We want to select Profile.
By default, disabled is selected. We want to select Profile.

Now that profile is selected, we will see a clock.
Now that profile is selected, we will see a clock.

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.
Empty webgrind

After you select a profile file (from the dropdown with “Auto (newest)” pre selected) and click “update”, you will see your profiling information.

Screen Shot 2013-12-23 at 12.40.01 PM

And that is all it takes to get started with profiling on Varying Vagrant Vagrants with xdebug and webgrind. Happy Profiling.