perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/util perl_bloat.pl
Date Fri, 05 Oct 2001 17:25:38 GMT
stas        01/10/05 10:25:38

  Modified:    util     perl_bloat.pl
  Log:
  - extend to report separately the added size for each arg in ARGV + total
  - handle Foo/Bar.pm in addition to Foo::Bar and code snippets
  
  Revision  Changes    Path
  1.2       +24 -6     modperl-2.0/util/perl_bloat.pl
  
  Index: perl_bloat.pl
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/util/perl_bloat.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- perl_bloat.pl	2001/09/18 16:16:18	1.1
  +++ perl_bloat.pl	2001/10/05 17:25:37	1.2
  @@ -1,12 +1,24 @@
   #!/usr/bin/perl -w
   
  +# perlbloat.pl 'some perlcode' 'more perl code'
  +# perlbloat.pl Foo/Bar.pm Bar/Tar.pm
  +# perlbloat.pl Foo::Bar Bar::Tar
  +
  +no warnings;
  +
   use GTop ();
   
   my $gtop = GTop->new;
  -my $before = $gtop->proc_mem($$)->size;
   
  +my $total = 0;
   for (@ARGV) {
  -    if (eval "require $_") {
  +
  +    my $code = $_;
  +    file2package($_) if /\S+\.pm$/;
  +
  +    my $before = $gtop->proc_mem($$)->size;
  +
  +    if (eval "require $_" ) {
           eval {
               $_->import;
           };
  @@ -15,11 +27,17 @@
           eval $_;
           die $@ if $@;
       }
  -}
  -
  -my $after = $gtop->proc_mem($$)->size;
   
  -printf "@ARGV added %s\n", GTop::size_string($after - $before);
  +    my $after = $gtop->proc_mem($$)->size;
  +    printf "%-30s added %s\n", $_, GTop::size_string($after - $before);
  +    $total += $after - $before;
  +}
   
  +print "-" x 46, "\n";
  +printf "Total added %30s\n", GTop::size_string($total);
   
  +sub file2package {
  +    $_[0] =~ s|/|::|g;
  +    $_[0] =~ s|\.pm$||;
  +}
   
  
  
  

Mime
View raw message