Customizing P3 Profiler’s Auto Scan

Our P3 Plugin has an automatic scan mode that picks pages at random from your site to scan for performance. The pages aren’t really random, though. P3 actually picks:

  1. Home page
  2. Four random tags
  3. Four random categories
  4. Four latest posts
  5. Admin dashboard
  6. Admin posts page
  7. Admin plugins page

Some of the pages are shuffled to help defeat the effects of caching and get a better measurement of plugin performance. This should be a good configuration for most users, but some of our more advanced users have asked for greater control over this behavior. In version 1.4, we added a filter named p3_automatic_scan_urls to allow other plugins to customize this list.

Here’s an example plugin to get you started:

/*
Plugin Name: P3 Custom Scanner
Plugin URI: http://inside.godaddy.com/
Description: Customize the pages scanned by P3's auto scan mode
Author: GoDaddy.com
Version: 1.0
Author URI: http://www.godaddy.com/
*/

function my_p3_auto_scan_pages() {
    return array(
        home_url(),
        home_url( '2011/01/some-post' ),
        home_url( '?s=search+string+here' ),
        admin_url( 'plugins.php' )
    );
}
add_filter( 'p3_automatic_scan_urls', 'my_p3_auto_scan_pages' );

For an example that allows you to edit the URL list in a text area on your options page, see this plugin on gisthub.

Thanks to our users for this suggestion!

Kurt started at Go Daddy in April 2007 in the hosting department as an internal hosting tools developer. He quickly moved up to lead developer and eventually became the team's Software Development Manager. Kurt has also worked on internal tools for the productivity apps team. In June 2011, Kurt started contributing to the WordPress core. Connect with Kurt on Google+

Got something to say? Go for it!

 
Traffic Log Image