[wp-testers] PHP/WP profiler tool?

Daniel Westermann-Clark daniel at acceleration.net
Fri Nov 11 22:39:37 GMT 2005


On 2005-11-11 17:22:40 -0500, Doug Stewart wrote:
> Howdy all:
> Anyone know of a quick-n-dirty way for me to figure out what exactly
> is slowing my site down?  I'm hosting four blogs on one server and
> have kitted the others out with minimal 1.6 installs.  Mine is
> running 1.5.2 with a boatload of plugins.  I'd like to keep as many
> of them as possible, but I'd like to figure out which, if any, of
> those plugins are responsible for the s l o w a s m o l a s s e s
> performance of my main site.

I wrote a very simple profiling tool [1] for this purpose ... it may
not be what you need, but it helped me reduce the home page load time
for one of my sites by about 40%.

Basically you wrap sections of your template with calls to the plugin
functions.  For example:

<?php if (function_exists('profiler_push')) profiler_push(); ?>
<?php /* ... something slow ... */ ?>
<!-- <?php if (function_exists('profiler_pop')) profiler_pop(); ?> s -->

That will output a comment like "<!-- 0.340 s -->".

I've also used PECL's apd [2] with some success, using the following
in my wp-config.php:

// Profile if available
if (function_exists('apd_set_pprof_trace') and $_GET['debug'])
    apd_set_pprof_trace();

That lets you append ?debug=1 to URLs.  apd outputs profiling data,
which you then run pprofp on.  pprofp tells you which functions were
called the most, which functions took the longest to run, etc.  Pretty
nice, but takes a bit of effort.

[1] http://dev.webadmin.ufl.edu/~dwc/tmp/profiler.phps
[2] http://pecl.php.net/package/apd

-- 
Daniel Westermann-Clark


More information about the wp-testers mailing list