| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IPC::Run3::ProfPP; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 0.048; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
IPC::Run3::ProfPP - Generate reports from IPC::Run3 profiling data |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Used by IPC::Run3 and/or run3profpp to print out profiling reports for |
|
14
|
|
|
|
|
|
|
human readers. Use other classes for extracting data in other ways. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
The output methods are plain text, override these (see the source for |
|
17
|
|
|
|
|
|
|
now) to provide other formats. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This class generates reports on each run3_exit() and app_exit() call. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
require IPC::Run3::ProfReporter; |
|
24
|
|
|
|
|
|
|
@ISA = qw( IPC::Run3::ProfReporter ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
6176
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
47
|
|
|
27
|
1
|
|
|
1
|
|
1072
|
use POSIX qw( floor ); |
|
|
1
|
|
|
|
|
7697
|
|
|
|
1
|
|
|
|
|
8
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 METHODS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 C<< IPC::Run3::ProfPP->new() >> |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Returns a new profile reporting object. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
11
|
|
|
11
|
|
12
|
sub _emit { shift; warn @_ } |
|
|
11
|
|
|
|
|
45
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _t { |
|
40
|
8
|
|
|
8
|
|
57
|
sprintf "%10.6f secs", @_; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _r { |
|
44
|
3
|
|
|
3
|
|
22
|
my ( $num, $denom ) = @_; |
|
45
|
3
|
50
|
|
|
|
7
|
return () unless $denom; |
|
46
|
3
|
|
|
|
|
15
|
sprintf "%10.6f", $num / $denom; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _pct { |
|
50
|
5
|
|
|
5
|
|
5
|
my ( $num, $denom ) = @_; |
|
51
|
5
|
50
|
|
|
|
9
|
return () unless $denom; |
|
52
|
5
|
|
|
|
|
39
|
sprintf " (%3d%%)", floor( 100 * $num / $denom + 0.5 ); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 C<< $profpp->handle_app_call() >> |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub handle_app_call { |
|
60
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
61
|
1
|
|
|
|
|
9
|
$self->_emit("IPC::Run3 parent: ", |
|
62
|
1
|
|
|
|
|
2
|
join( " ", @{$self->get_app_cmd} ), |
|
63
|
|
|
|
|
|
|
"\n", |
|
64
|
|
|
|
|
|
|
); |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
5
|
$self->{NeedNL} = 1; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 C<< $profpp->handle_app_exit() >> |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub handle_app_exit { |
|
74
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
75
|
|
|
|
|
|
|
|
|
76
|
1
|
50
|
33
|
|
|
8
|
$self->_emit("\n") if $self->{NeedNL} && $self->{NeedNL} != 1; |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
8
|
$self->_emit( "IPC::Run3 total elapsed: ", |
|
79
|
|
|
|
|
|
|
_t( $self->get_app_cumulative_time ), |
|
80
|
|
|
|
|
|
|
"\n"); |
|
81
|
1
|
|
|
|
|
7
|
$self->_emit( "IPC::Run3 calls to run3(): ", |
|
82
|
|
|
|
|
|
|
sprintf( "%10d", $self->get_run_count ), |
|
83
|
|
|
|
|
|
|
"\n"); |
|
84
|
1
|
|
|
|
|
8
|
$self->_emit( "IPC::Run3 total spent in run3(): ", |
|
85
|
|
|
|
|
|
|
_t( $self->get_run_cumulative_time ), |
|
86
|
|
|
|
|
|
|
_pct( $self->get_run_cumulative_time, $self->get_app_cumulative_time ), |
|
87
|
|
|
|
|
|
|
", ", |
|
88
|
|
|
|
|
|
|
_r( $self->get_run_cumulative_time, $self->get_run_count ), |
|
89
|
|
|
|
|
|
|
" per call", |
|
90
|
|
|
|
|
|
|
"\n"); |
|
91
|
1
|
|
|
|
|
5
|
my $exclusive = |
|
92
|
|
|
|
|
|
|
$self->get_app_cumulative_time - $self->get_run_cumulative_time; |
|
93
|
1
|
|
|
|
|
10
|
$self->_emit( "IPC::Run3 total spent not in run3(): ", |
|
94
|
|
|
|
|
|
|
_t( $exclusive ), |
|
95
|
|
|
|
|
|
|
_pct( $exclusive, $self->get_app_cumulative_time ), |
|
96
|
|
|
|
|
|
|
"\n"); |
|
97
|
1
|
|
|
|
|
8
|
$self->_emit( "IPC::Run3 total spent in children: ", |
|
98
|
|
|
|
|
|
|
_t( $self->get_sys_cumulative_time ), |
|
99
|
|
|
|
|
|
|
_pct( $self->get_sys_cumulative_time, $self->get_app_cumulative_time ), |
|
100
|
|
|
|
|
|
|
", ", |
|
101
|
|
|
|
|
|
|
_r( $self->get_sys_cumulative_time, $self->get_run_count ), |
|
102
|
|
|
|
|
|
|
" per call", |
|
103
|
|
|
|
|
|
|
"\n"); |
|
104
|
1
|
|
|
|
|
5
|
my $overhead = |
|
105
|
|
|
|
|
|
|
$self->get_run_cumulative_time - $self->get_sys_cumulative_time; |
|
106
|
1
|
|
|
|
|
2
|
$self->_emit( "IPC::Run3 total overhead: ", |
|
107
|
|
|
|
|
|
|
_t( $overhead ), |
|
108
|
|
|
|
|
|
|
_pct( |
|
109
|
|
|
|
|
|
|
$overhead, |
|
110
|
|
|
|
|
|
|
$self->get_sys_cumulative_time |
|
111
|
|
|
|
|
|
|
), |
|
112
|
|
|
|
|
|
|
", ", |
|
113
|
|
|
|
|
|
|
_r( $overhead, $self->get_run_count ), |
|
114
|
|
|
|
|
|
|
" per call", |
|
115
|
|
|
|
|
|
|
"\n"); |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 C<< $profpp->handle_run_exit() >> |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub handle_run_exit { |
|
123
|
1
|
|
|
1
|
1
|
1
|
my $self = shift; |
|
124
|
1
|
|
|
|
|
3
|
my $overhead = $self->get_run_time - $self->get_sys_time; |
|
125
|
|
|
|
|
|
|
|
|
126
|
1
|
50
|
33
|
|
|
10
|
$self->_emit("\n") if $self->{NeedNL} && $self->{NeedNL} != 2; |
|
127
|
1
|
|
|
|
|
4
|
$self->{NeedNL} = 3; |
|
128
|
|
|
|
|
|
|
|
|
129
|
1
|
|
|
|
|
5
|
$self->_emit( "IPC::Run3 child: ", |
|
130
|
1
|
|
|
|
|
2
|
join( " ", @{$self->get_run_cmd} ), |
|
131
|
|
|
|
|
|
|
"\n"); |
|
132
|
1
|
|
|
|
|
11
|
$self->_emit( "IPC::Run3 run3() : ", _t( $self->get_run_time ), "\n", |
|
133
|
|
|
|
|
|
|
"IPC::Run3 child : ", _t( $self->get_sys_time ), "\n", |
|
134
|
|
|
|
|
|
|
"IPC::Run3 overhead: ", _t( $overhead ), |
|
135
|
|
|
|
|
|
|
_pct( $overhead, $self->get_sys_time ), |
|
136
|
|
|
|
|
|
|
"\n"); |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 LIMITATIONS |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 LICENSE |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
You may use this module under the terms of the BSD, Artistic, or GPL licenses, |
|
148
|
|
|
|
|
|
|
any version. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Barrie Slaymaker Ebarries@slaysys.comE |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |