| IPC-Run3 documentation | Contained in the IPC-Run3 distribution. |
IPC::Run3::ProfPP - Generate reports from IPC::Run3 profiling data
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.
IPC::Run3::ProfPP->new()Returns a new profile reporting object.
$profpp->handle_app_call()$profpp->handle_app_exit()$profpp->handle_run_exit()Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved
You may use this module under the terms of the BSD, Artistic, or GPL licenses, any version.
Barrie Slaymaker <barries@slaysys.com>
| IPC-Run3 documentation | Contained in the IPC-Run3 distribution. |
package IPC::Run3::ProfPP; $VERSION = 0.044;
require IPC::Run3::ProfReporter; @ISA = qw( IPC::Run3::ProfReporter ); use strict; use POSIX qw( floor );
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 ); }
sub handle_app_call { my $self = shift; $self->_emit("IPC::Run3 parent: ", join( " ", @{$self->get_app_cmd} ), "\n", ); $self->{NeedNL} = 1; }
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"); }
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"); }
1;