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