| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
$VERSION = 0.049; |
| 4 |
|
| 5 |
=head1 NAME |
| 6 |
|
| 7 |
run3profpp - Report on IPC::Run3 profiling data |
| 8 |
|
| 9 |
=head1 SYNOPSIS |
| 10 |
|
| 11 |
$ run3profpp [<profile_file_name>] |
| 12 |
|
| 13 |
=head1 DESCRIPTION |
| 14 |
|
| 15 |
IPC::Run3 may be run with profiling data enabled. It may report as it runs |
| 16 |
or dump all of the data to a file. This program reads that file and generates |
| 17 |
reports based on it. |
| 18 |
|
| 19 |
The default filename is run3.out. |
| 20 |
|
| 21 |
=cut |
| 22 |
|
| 23 |
use strict; |
| 24 |
use Getopt::Long; |
| 25 |
|
| 26 |
sub _program_name { |
| 27 |
require File::Basename; |
| 28 |
File::Basename::basename( $0 ); |
| 29 |
} |
| 30 |
|
| 31 |
sub _usage { |
| 32 |
my ( $message ) = @_; |
| 33 |
## Don't slow execution by always loading a rarely needed module. |
| 34 |
## At least, we hope it's rarely needed. |
| 35 |
require Pod::Usage; |
| 36 |
|
| 37 |
$message = "Unknown error (message not provided)" |
| 38 |
if defined $message && ! length $message; |
| 39 |
|
| 40 |
my $help_mode = ! defined $message; |
| 41 |
|
| 42 |
my $exitval = $help_mode ? 0 : do { |
| 43 |
# The "message" may be a simple number, in which case it's an |
| 44 |
# exit value. |
| 45 |
$message =~ s/\A(\d+)\z// ? $1 : 1 |
| 46 |
}; |
| 47 |
|
| 48 |
Pod::Usage::pod2usage( |
| 49 |
-verbose => $help_mode ? 2 : 1, |
| 50 |
defined $message && length $message |
| 51 |
? ( -message => $message ) |
| 52 |
: (), |
| 53 |
-exitval => $exitval, |
| 54 |
); |
| 55 |
} |
| 56 |
|
| 57 |
=head1 OPTIONS |
| 58 |
|
| 59 |
=over |
| 60 |
|
| 61 |
=item --help, -h, -? |
| 62 |
|
| 63 |
Print out full help text. |
| 64 |
|
| 65 |
=back |
| 66 |
|
| 67 |
=cut |
| 68 |
|
| 69 |
GetOptions( |
| 70 |
"help|h|?" => sub { _usage }, |
| 71 |
) or _usage 1; |
| 72 |
|
| 73 |
# _usage "Too few parameters" unless @ARGV > 0; |
| 74 |
# _usage "Too many parameters" if @ARGV > 0; |
| 75 |
|
| 76 |
############################################################################### |
| 77 |
# |
| 78 |
# Main program body |
| 79 |
# |
| 80 |
|
| 81 |
# |
| 82 |
# End of the main program body |
| 83 |
# |
| 84 |
############################################################################### |
| 85 |
|
| 86 |
=head1 LIMITATIONS |
| 87 |
|
| 88 |
=head1 COPYRIGHT |
| 89 |
|
| 90 |
Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved |
| 91 |
|
| 92 |
=head1 LICENSE |
| 93 |
|
| 94 |
You may use this module under the terms of the BSD, Artistic, or GPL licenses, |
| 95 |
any version. |
| 96 |
|
| 97 |
=head1 AUTHOR |
| 98 |
|
| 99 |
Barrie Slaymaker <[email protected]> |
| 100 |
|
| 101 |
=cut |
| 102 |
|
| 103 |
1; |