line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Memalyzer::Runner; |
2
|
4
|
|
|
4
|
|
4008
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
176
|
|
3
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
148
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
24
|
use base 'Devel::Memalyzer::Base'; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
2344
|
|
6
|
4
|
|
|
4
|
|
2576
|
use Devel::Memalyzer; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
3664
|
use Time::HiRes qw/sleep/; |
|
4
|
|
|
|
|
6820
|
|
|
4
|
|
|
|
|
12
|
|
9
|
4
|
|
|
4
|
|
3800
|
use POSIX; |
|
4
|
|
|
|
|
28244
|
|
|
4
|
|
|
|
|
28
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->gen_accessors(qw/ command interval /); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub run { |
14
|
5
|
|
|
5
|
0
|
279
|
my $self = shift; |
15
|
5
|
|
|
|
|
34
|
$self->collect; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _run { |
19
|
12
|
|
|
12
|
|
284
|
my $self = shift; |
20
|
12
|
100
|
|
|
|
251
|
die ( "already ran" ) if $self->{ _run }++; |
21
|
9
|
100
|
|
|
|
12244
|
exec $self->command unless my $pid = fork(); |
22
|
6
|
|
|
|
|
747
|
return $pid; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub collect { |
26
|
5
|
|
|
5
|
0
|
30
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
5
|
|
|
|
|
17
|
my $pid = $self->_run; |
29
|
3
|
|
|
|
|
290
|
until ( waitpid( $pid, &POSIX::WNOHANG )) { |
30
|
39
|
|
|
|
|
1019
|
Devel::Memalyzer->singleton->record( $pid ); |
31
|
39
|
|
100
|
|
|
846
|
sleep ($self->interval || 1 ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |