config root man

Current Path : /usr/local/lib/perl5/site_perl/5.8.9/mach/Apache/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/lib/perl5/site_perl/5.8.9/mach/Apache/Symdump.pm

package Apache::Symdump;

use strict;
use Devel::Symdump ();
use Apache::File ();

my $X = 0;

sub logfile {
    my($r, $name) = @_;
    $r->server_root_relative("logs/$name.$$.$X");
}

sub inc_snap {
    my $r = shift;
    my $fname = logfile($r, "incdump");
    my $fh = Apache::File->new(">$fname") or die $!;
    print $fh map { "$_ = $INC{$_}\n" } sort keys %INC;
    close $fh;
}

sub handler {
    my $r = shift;
    my $fname = logfile($r, "symdump");
    my $fh = Apache::File->new(">$fname") or die $!;
    print $fh +Devel::Symdump->rnew()->as_string;
    close $fh;
    inc_snap($r);
    $X++;
}

1;
__END__

=head1 NAME

Apache::Symdump - Symbol table snapshots

=head1 SYNOPSIS

 PerlLogHandler Apache::Symdump

=head1 DESCRIPTION

Apache:Symdump uses Devel::Symdump to record snapshots of the Perl symbol
table in ServerRoot/logs/symdump.$$.$n
Where B<$$> is the process id and B<$n> is incremented each time the handler
is run.  The B<diff> utility can be used to compare snapshots and get an idea
of what might be making a process grow.  Normally, new symbols come from 
modules or scripts that were not preloaded, the Perl method cache, etc.

 % diff -u symdump.$$.0 symdump.$$.1

=head1 CAVEATS

Apache::Symdump does not cleanup up its snapshot files, do so simply by:

 % rm logs/symdump.* logs/incdump.*

=head1 SEE ALSO

Devel::Symdump(3), Apache::Leak(3)

=head1 AUTHOR

Doug MacEachern

Man Man