perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@hyperreal.org
Subject cvs commit: modperl/lib/Apache Symdump.pm
Date Sun, 08 Nov 1998 02:03:24 GMT
dougm       98/11/07 18:03:23

  Modified:    .        Changes MANIFEST
  Added:       lib/Apache Symdump.pm
  Log:
  new Apache::Symdump module
  
  Revision  Changes    Path
  1.189     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.188
  retrieving revision 1.189
  diff -u -r1.188 -r1.189
  --- Changes	1998/11/08 01:21:11	1.188
  +++ Changes	1998/11/08 02:03:21	1.189
  @@ -8,6 +8,8 @@
   
   =item 1.16_01-dev
   
  +new Apache::Symdump module
  +
   allow $VirtualHost{'111.22.33.55'} = [...] syntax in <Perl> sections
   
   Perl*Handler commands will now call perl_startup() if Perl is not
  
  
  
  1.48      +1 -0      modperl/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /export/home/cvs/modperl/MANIFEST,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- MANIFEST	1998/10/29 20:53:24	1.47
  +++ MANIFEST	1998/11/08 02:03:22	1.48
  @@ -59,6 +59,7 @@
   lib/Apache/SIG.pm
   lib/Apache/SizeLimit.pm
   lib/Apache/StatINC.pm
  +lib/Apache/Symdump.pm
   lib/Apache/Constants/Exports.pm
   Apache/Apache.pm
   Apache/typemap
  
  
  
  1.1                  modperl/lib/Apache/Symdump.pm
  
  Index: 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
  
  
  

Mime
View raw message