Coverage Summary
File Coverage
| blib/lib/Sledge/Plugin/DebugLeakChecker.pm |
|
| Criterion |
Covered |
Total |
% |
| statement |
17 |
35 |
48.5
|
| branch |
0 |
8 |
0.0
|
| condition |
|
|
n/a
|
| subroutine |
5 |
7 |
71.4
|
| pod |
|
|
n/a
|
| total |
22 |
50 |
44.0
|
| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sledge::Plugin::DebugLeakChecker; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22479
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
764
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
44
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3052
|
use Template; |
|
|
1
|
|
|
|
|
51403
|
|
|
|
1
|
|
|
|
|
36
|
|
|
8
|
1
|
|
|
1
|
|
1041
|
use Devel::Leak::Object qw{ GLOBAL_bless }; |
|
|
1
|
|
|
|
|
2983
|
|
|
|
1
|
|
|
|
|
8
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $FIREBUG = 0; |
|
11
|
|
|
|
|
|
|
our $TEMPLATE = <<'EOF'; |
|
12
|
|
|
|
|
|
|
[%- IF FIREBUG %] |
|
13
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
[% ELSE %] |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Leak Modules |
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
| | Module Name | Leak Count |
|
24
|
|
|
|
|
|
|
[%- FOR e IN devel_leak_object_count_entries %] |
|
25
|
|
|
|
|
|
|
| | [% e.key | html %] | [% e.value | html %] |
|
26
|
|
|
|
|
|
|
[% END # END FOR -%] |
|
27
|
|
|
|
|
|
|
| |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
[% END # END IF -%] |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
EOF |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub import { |
|
34
|
1
|
|
|
1
|
|
44
|
my $class = shift; |
|
35
|
1
|
|
|
|
|
3
|
my @args = @_; |
|
36
|
1
|
|
|
|
|
2
|
my $pkg = caller; |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
3
|
foreach my $arg (@args) { |
|
39
|
0
|
0
|
|
|
|
0
|
if(uc($arg) eq 'FIREBUG') { |
|
40
|
0
|
|
|
|
|
0
|
$FIREBUG = 1; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$pkg->register_hook(BEFORE_OUTPUT => sub { |
|
45
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
46
|
0
|
0
|
|
|
|
|
if ($self->debug_level) { |
|
47
|
|
|
|
|
|
|
$self->add_filter(sub { |
|
48
|
0
|
|
|
|
|
|
$class->_debug_message_filter(@_); |
|
49
|
0
|
|
|
|
|
|
}); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
1
|
|
|
|
|
13
|
}); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _debug_message_filter { |
|
56
|
0
|
|
|
0
|
|
|
my ($self, $pages, $content) = @_; |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my %devel_leak_object_count_entries; |
|
59
|
0
|
|
|
|
|
|
for (sort keys %Devel::Leak::Object::OBJECT_COUNT) { |
|
60
|
0
|
0
|
|
|
|
|
next unless $Devel::Leak::Object::OBJECT_COUNT{$_}; # Don't list class with count zero |
|
61
|
0
|
|
|
|
|
|
$devel_leak_object_count_entries{ sprintf( "%-40s",$_) } = $Devel::Leak::Object::OBJECT_COUNT{$_}; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $tt = Template->new; |
|
65
|
0
|
|
|
|
|
|
$tt->process( |
|
66
|
|
|
|
|
|
|
\$TEMPLATE, |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
|
|
|
|
|
|
devel_leak_object_count_entries => \%devel_leak_object_count_entries, |
|
69
|
|
|
|
|
|
|
FIREBUG => $FIREBUG |
|
70
|
|
|
|
|
|
|
}, |
|
71
|
|
|
|
|
|
|
\my $out); |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
if( $content =~ /<\/body>/ ) { |
|
74
|
0
|
|
|
|
|
|
$content =~ s/<\/body>/$out/; |
|
75
|
|
|
|
|
|
|
} else { |
|
76
|
0
|
|
|
|
|
|
$out =~ s/<\/body>//; |
|
77
|
0
|
|
|
|
|
|
$content .= $out; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
0
|
|
|
|
|
|
return $content; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Sledge::Plugin::DebugLeakChecker - Show the memory leak situation of perl modules for Sledge |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Version 0.01 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 Apache setting |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
At first, write this in the startup.pl |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
BEGIN { |
|
101
|
|
|
|
|
|
|
use Devel::Leak::Object qw{ GLOBAL_bless }; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Example of httpd.conf when I debug it. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
MinSpareServers 1 |
|
107
|
|
|
|
|
|
|
MaxSpareServers 1 |
|
108
|
|
|
|
|
|
|
StartServers 1 |
|
109
|
|
|
|
|
|
|
MaxRequestsPerChild 0 |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 Sledge Pages Class setting |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
B |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Information is added to the lower part of Web pages displaying now. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
use Sledge::Plugin::BeforeOutput; |
|
119
|
|
|
|
|
|
|
use Sledge::Plugin::DebugLeakChecker; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
... |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
B |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
It is necessary to install Firebug beforehand. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Information is output by console of the Firebug. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
use Sledge::Plugin::BeforeOutput; |
|
130
|
|
|
|
|
|
|
use Sledge::Plugin::DebugLeakChecker qw(Firebug); |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
... |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This module provides information that is leak situation of perl modules. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
When you use mod_perl with Apache, I think it to be able to get particularly effective information. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L L |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Firebug Firefox Add-ons |
|
147
|
|
|
|
|
|
|
L |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Firebug Lite for IE, Opera and Safari |
|
150
|
|
|
|
|
|
|
L |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 BUGS |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Please report any bugs or suggestions at |
|
155
|
|
|
|
|
|
|
L |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 AUTHOR |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
syushi matsumoto, C<< >> |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Copyright (C) 2009 Alink INC. all rights reserved. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
168
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
169
|
|
|
|
|
|
|
|