line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Memory::Process; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
108807
|
use base qw(Memory::Usage); |
|
8
|
|
|
|
|
57
|
|
|
8
|
|
|
|
|
3692
|
|
4
|
8
|
|
|
8
|
|
5353
|
use strict; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
150
|
|
5
|
8
|
|
|
8
|
|
40
|
use warnings; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
201
|
|
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
4343
|
use Readonly; |
|
8
|
|
|
|
|
31438
|
|
|
8
|
|
|
|
|
2706
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Constants. |
10
|
|
|
|
|
|
|
Readonly::Scalar our $EMPTY_STR => q{}; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.05; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Record. |
15
|
|
|
|
|
|
|
sub record { |
16
|
7
|
|
|
7
|
1
|
1005259
|
my ($self, $message, $pid) = @_; |
17
|
7
|
100
|
|
|
|
32
|
if (! defined $message) { |
18
|
2
|
|
|
|
|
5
|
$message = $EMPTY_STR; |
19
|
|
|
|
|
|
|
} |
20
|
7
|
|
|
|
|
50
|
return $self->SUPER::record($message, $pid); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Print report to STDERR. |
24
|
|
|
|
|
|
|
sub dump { |
25
|
2
|
|
|
2
|
1
|
3357
|
my $self = shift; |
26
|
2
|
|
|
|
|
12
|
return print STDERR scalar $self->report; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Get report. |
30
|
|
|
|
|
|
|
sub report { |
31
|
4
|
|
|
4
|
1
|
922
|
my $self = shift; |
32
|
4
|
|
|
|
|
26
|
my $report = $self->SUPER::report; |
33
|
4
|
|
|
|
|
98
|
my @report_full = split m/\n/ms, $report; |
34
|
4
|
|
|
|
|
11
|
my @report = (); |
35
|
4
|
100
|
|
|
|
16
|
if (@report_full > 2) { |
36
|
1
|
|
|
|
|
4
|
@report = ($report_full[0], $report_full[-2], $report_full[-1]); |
37
|
|
|
|
|
|
|
}; |
38
|
4
|
|
|
|
|
13
|
my $report_scalar = (join "\n", @report); |
39
|
4
|
100
|
|
|
|
15
|
if ($report_scalar ne $EMPTY_STR) { |
40
|
1
|
|
|
|
|
4
|
$report_scalar .= "\n"; |
41
|
|
|
|
|
|
|
} |
42
|
4
|
100
|
|
|
|
74
|
return wantarray ? @report : $report_scalar; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Reset records. |
46
|
|
|
|
|
|
|
sub reset { |
47
|
1
|
|
|
1
|
1
|
1269
|
my $self = shift; |
48
|
1
|
|
|
|
|
2
|
@{$self} = (); |
|
1
|
|
|
|
|
3
|
|
49
|
1
|
|
|
|
|
3
|
return; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Get state. |
53
|
|
|
|
|
|
|
sub state { |
54
|
2
|
|
|
2
|
1
|
238
|
my $self = shift; |
55
|
2
|
|
|
|
|
3
|
return [@{$self}]; |
|
2
|
|
|
|
|
9
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |