This is a start on xhprof support. It's very limited at the moment.

Requirements:
* Have xhprof installed and running (I had to build the extension manually with make / make install etc. - pecl package is broken): http://techportal.ibuildings.com/2009/12/01/profiling-with-xhprof/

* Have a web accessible url for xhprof_html/index.php on the same server as the one you're profiling.

With these two, you get a link alongside the memory output from devel linking to full profiling information for that page.

TODOs - leave it up to you if these need to happen before anything gets committed:

* Have devel generate the output which index.php currently does to avoid having to set that up at a publically accessible URL. I made a start on this, but the xhprof developers apparently love globals a lot, which means my original plan of include_once 'xhprof_html/index.php'; drupal_exit(); in a page callback was foiled.
* Try to avoid having variables for the location of xhprof. Could instead require that the tarball is extracted into the libraries folder or something?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Got a bit further with drupal output until I ran into the $sortable_columns (and friends) in xhprof.php.

Don't see this getting much better without refactoring the xhprof codebase itself :( Uploading progress so far anyway.

catch’s picture

FileSize
4.42 KB

Fix stupid #default_value typo from original patch.

catch’s picture

moshe weitzman’s picture

i'm willing to do light integration or more full integration if the xhprof web team will address that issue.

catch’s picture

I think this is more or less as good as we'll get for the moment unless that issue gets addressed.

Although with #1 I got the report to render, just with a tonne of notices, so there may just be a few more globals to declare to make it work, if I find some time I might look into it more. Would need to do the same for callgraph.php as well.

Here's screenshots of how it looks, will look exactly the same if we get better integration going, just skips the extra step of setting up xhprof_html in a web accessible directory.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed. I enhanced the admin ui a bit so that the fieldset is always shown but the enabled checkbox can't be checked until the extension is available. This documents the feature and encourages its use.

catch’s picture

Title: XHProf support » Display XHProf output via a devel menu callback
Status: Fixed » Active

Nice. Thanks Moshe.

Re-opening this to get the reports displaying inside Drupal, I'd still like to get that working one way or the other.

kbahey’s picture

Someone started a project for XHprof here http://drupal.org/project/XHProf. It has no code so far though. @catch, can you ask them to contribute to devel instead.

catch’s picture

Thanks for the heads up, posted #762210: Please join forces with devel module.

sdboyer’s picture

subscribe.

this is hawt.

catch’s picture

brianmercer’s picture

When the module asks for the xhprof directory, "Location of the xhprof source code..." which files is it looking for?

moshe weitzman’s picture

the xhprof program. thats not part of drupal or devel. you have to get it separately. see link in original post.

brianmercer’s picture

Thanks for the response. I wasn't sure what was meant by "source code" on the settings page but I understand now that it wants the directory above xhprof_lib.

I made an Ubuntu package for xhprof to make it easier to install for some folks and added the proper settings for devel-7.x and for nginx at http://groups.drupal.org/node/82889.

Great addition to devel, thanks.

msonnabaum’s picture

I've been playing around a bit with making a native UI to view runs. Code is still very rough and mostly hacked together from facebook's UI, but listing of runs and viewing runs should work:

https://github.com/msonnabaum/xhprof_ui

Still need to implement per-function page callbacks and figure out how to page the listing of runs, but its a start.

willzyx’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Closing for lack of activity. Feel free to reopen if the issue still exists