The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DashProfiler::Apache - Hook DashProfiler into Apache mod_perl (v1 or v2)

SYNOPSIS

To hook DashProfiler into Apache you add this to your httpd.conf:

    PerlModule DashProfiler::Apache;
    PerlInitHandler       DashProfiler::Apache::start_sample_period_all_profiles
    PerlCleanupHandler    DashProfiler::Apache::end_sample_period_all_profiles
    PerlChildExitHandler  DashProfiler::Apache::flush_all_profiles

You'll also need to define at least one profile. An easy way of doing that is to use DashProfiler::Auto to get a predefined profile called 'auto':

    PerlModule DashProfiler::Auto;

Or you can define your own, like this:

    PerlModule DashProfiler::Apache;
    <Perl>
        DashProfile->add_profile( foo => { ... } );
    </Perl>

DESCRIPTION

The DashProfiler module itself will work just fine with Apache. The DashProfiler::Apache just fine-tunes the integration in a few ways:

* Sets a precondition on start_sample_period_all_profiles() so that it only starts a period for 'initial' requests (where $r->is_initial_req is true). This is typically only relevant if your code uses $r->internal_redirect.

* Adds a simple trace mechanism so you can easily see which DashProfiler::Apache functions are called for which Apache handlers.

Example Apache mod_perl Configuration

    PerlModule DashProfiler::Apache;
    PerlInitHandler       DashProfiler::Apache::start_sample_period_all_profiles
    PerlCleanupHandler    DashProfiler::Apache::end_sample_period_all_profiles
    PerlChildExitHandler  DashProfiler::Apache::flush_all_profiles
    <Perl>
        # files will be written to $spool_directory/dashprofiler.subsys.ppid.pid
        DashProfiler->add_profile('subsys', {
            granularity => 30,
            flush_interval => 60,
            add_exclusive_sample => 'other',
            spool_directory => '/tmp', # needs write permission for apache user
        });
    </Perl>

AUTHOR

DashProfiler by Tim Bunce, http://www.tim.bunce.name and http://blog.timbunce.org

COPYRIGHT

The DashProfiler distribution is Copyright (c) 2007-2008 Tim Bunce. Ireland. All rights reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.