Changeset 2340

Show
Ignore:
Timestamp:
05/15/08 19:31:42 (21 months ago)
Author:
bchoate
Message:

Issue reporting through debug method.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-38/lib/MT/TheSchwartz.pm

    r2337 r2340  
    175175            $did_work = 0; 
    176176            if ($OBJECT_REPORT) { 
    177                 leak_report(\%obj_start, \%obj_pre, \%Devel::Leak::Object::OBJECT_COUNT); 
     177                my $report = leak_report(\%obj_start, \%obj_pre, \%Devel::Leak::Object::OBJECT_COUNT); 
     178                $client->debug($report) if $report ne ''; 
    178179            } 
    179180        } 
     
    185186our %persistent; 
    186187BEGIN { 
    187     %persistent = map { $_ => 1 } qw( MT::Task MT::Plugin MT::Component MT::ArchiveType MT::TaskMgr MT::WeblogPublisher MT::Serializer TheSchwartz::Job TheSchwartz::JobHandle ); 
     188    %persistent = map { $_ => 1 } qw( MT::Callback MT::Task MT::Plugin MT::Component MT::ArchiveType MT::TaskMgr MT::WeblogPublisher MT::Serializer TheSchwartz::Job TheSchwartz::JobHandle ); 
    188189} 
    189190sub leak_report { 
    190191    my ($start, $pre, $post) = @_; 
    191192    my $reported; 
     193    my $report = ''; 
    192194    foreach my $class (sort keys %$post) { 
    193195        # skip reporting classes that are persistent in nature 
     
    200202        next if $post_count == 1;  # ignores most singletons 
    201203        if (($pre_count != $post_count) || ($post_count != $start_count)) { 
    202             print "Leak report (class, total, delta from last job(s), delta since process start):\n" unless $reported; 
    203             printf "%-40s %-10d %-10d %-10d\n", $class, $post_count, $post_count - $pre_count, $post_count - $start_count; 
     204            $report .= "Leak report (class, total, delta from last job(s), delta since process start):\n" unless $reported; 
     205            $report .= sprintf("%-40s %-10d %-10d %-10d\n", $class, $post_count, $post_count - $pre_count, $post_count - $start_count); 
    204206            $reported = 1; 
    205207        } 
    206208    } 
     209    return $report; 
    207210} 
    208211