A coworker recently clued me in on Webgrind, a platform independent, browser-based PHP profiling application. I was impressed with it, and thought I'd contribute to the installation and usage instructions that are floating around the web with my specific setup.
Assumes you're using MAMP on OS X, but you can probably adapt.
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /path/to/htdocs/webgrind/tmp
xdebug.profiler_output_name = cachegrind.out.%t.%p
static $storageDir = '/path/to/htdocs/webgrind/tmp';
static $profilerDir = '/path/to/htdocs/webgrind/tmp';
(For another take on installation, see http://anantgarg.com/2009/03/10/php-xdebug-webgrind-installation/)
Once it's up and running, make some localhost requests. Then visit http://localhost/webgrind (or wherever you've installed Webgrind).
Select the profile file you'd like to use.
If you're using a CMS such as Drupal, I recommend setting the "Show" percentage to 100% (the default is 90%), as it's likely the code you're wanting to profile is your own, which tends to drop off into the last 10% when you're dealing with CMS profiling.
When the profiler finishes processing the profile data you selected, you'll get a report similar to that depicted below.
Worth noting is the blue, lavender (here it's just a sliver), green and orange bar. These colors represent the distribution of built-in PHP functions (blue), include/require functions (lavender), class methods (green) and procedural functions (orange). Down the left side of the list of functions profiled, the color of the dots maps to these categories.
Now, click the arrow next to a function and you'll get a listing of function invocations, where each call occurred and their costs. This listing corresponds to the invocation count column.
Note also the Total Self Cost and Total Inclusive Cost columns. The former indicates the processing time for only the code in the function, while the latter also includes processing for calls to other functions made from that code.
The paragraph icons service as a nice added feature. Clicking them opens a new tab or browser window with the contents of the file that function is defined in.
When you're done using Webgrind, either update your php.ini to set
xdebug.profiler_enable = 0
Or if you'd rather, leave the profiler enabled. It'll only create profile files for localhost requests. These can eat up drive space and slow Webgrind though, so I prefer to turn it off when not I'm not using Webgrind.
In summary, there are other, heavier-weight, and more fully featured web profiling applications out there (such as kcachegrind) but for ease of use, platform independence, and a succinct but effective feature set, Webgrind is a great addition to any PHP dev's toolbox.