/usr/bin/nytprofpf is in libdevel-nytprof-perl 6.04+dfsg-1build1.
This file is owned by root:root, with mode 0o755.
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 157 158 159 160 161 162 163 164 165 166 | #!/usr/bin/perl
##########################################################
## This script is part of the Devel::NYTProf distribution
##
## Copyright, contact and other information can be found
## at the bottom of this file, or by going to:
## https://metacpan.org/pod/Devel::NYTProf
##
###########################################################
=head1 NAME
nytprofpf - Generate a report for plat_forms (L<http://www.plat-forms.org/>) from Devel::NYTProf data
=head1 SYNOPSIS
Typical usage:
$ perl -d:NYTProf some_perl_app.pl
$ nytprofpf
Options synopsis:
--file <file>, -f <file> Read profile data from the specified file [default: nytprof.out]
--delete, -d Delete any old report files first
--lib <lib>, -l <lib> Add <lib> to the beginning of \@INC
--no-mergeevals Disable merging of string evals
--help, -h Print this message
This script of part of the Devel::NYTProf distribution. Generate a report for plat_forms (L<http://www.plat-forms.org/>) from Devel::NYTProf data.
See http://metacpan.org/release/Devel-NYTProf/ for details and copyright.
=encoding ISO8859-1
=cut
use warnings;
use strict;
use Carp;
use Config qw(%Config);
use Getopt::Long;
use List::Util qw(sum max);
use File::Copy;
use File::Path qw(rmtree);
use Devel::NYTProf::Reader;
use Devel::NYTProf::Core;
use Devel::NYTProf::Util qw(
fmt_float fmt_time fmt_incl_excl_time
calculate_median_absolute_deviation
get_abs_paths_alternation_regex
html_safe_filename
);
use Devel::NYTProf::Constants qw(NYTP_SCi_CALLING_SUB);
our $VERSION = '6.04';
if ($VERSION != $Devel::NYTProf::Core::VERSION) {
die "$0 version '$VERSION' doesn't match version '$Devel::NYTProf::Core::VERSION' of $INC{'Devel/NYTProf/Core.pm'}\n";
}
GetOptions(
'file|f=s' => \(my $opt_file = 'nytprof.out'),
'lib|l=s' => \my $opt_lib,
'out|o=s' => \(my $opt_out = 'nytprof'),
'delete|d!' => \my $opt_delete,
'help|h' => sub { exit usage() },
'mergeevals!'=> \(my $opt_mergeevals = 1),
) or do { exit usage(); };
sub usage {
print <<END;
usage: [perl] nytprofpf [opts]
--file <file>, -f <file> Read profile data from the specified file [default: nytprof.out]
--delete, -d Delete any old report files first
--lib <lib>, -l <lib> Add <lib> to the beginning of \@INC
--no-mergeevals Disable merging of string evals
--help, -h Print this message
This script of part of the Devel::NYTProf distribution.
See http://metacpan.org/release/Devel-NYTProf/ for details and copyright.
END
return 0;
}
use constant NUMERIC_PRECISION => 7;
# handle output location
if (!-e $opt_out) {
# everything is fine
}
elsif (!-f $opt_out) {
die "$0: Specified output file '$opt_out' already exists as a directory!\n";
}
elsif (!-w $opt_out) {
die "$0: Unable to write to output directory '$opt_out'\n";
}
else {
if (defined($opt_delete)) {
print "Deleting existing $opt_out file\n";
rm($opt_out);
}
}
# handle custom lib path
if (defined($opt_lib)) {
warn "$0: Specified lib directory '$opt_lib' does not exist.\n"
unless -d $opt_lib;
require lib;
lib->import($opt_lib);
}
$SIG{USR2} = \&Carp::cluck
if exists $SIG{USR2}; # some platforms don't have SIGUSR2 (Windows)
my $reporter = new Devel::NYTProf::Reader($opt_file, {
quiet => 0,
skip_collapse_evals => !$opt_mergeevals,
});
my $profile = $reporter->{profile};
open my $fh, '>', $opt_out
or croak "Unable to open file $opt_out: $!";
print $fh subroutine_table($profile, undef, 0, 'excl_time');
close $fh;
sub subroutine_table {
my ($profile, $fi, $max_subs, $sortby) = @_;
$sortby ||= 'excl_time';
my $subs_unsorted = $profile->subname_subinfo_map;
my $inc_path_regex = get_abs_paths_alternation_regex([$profile->inc], qr/^|\[/);
my @all_subs =
sort { $b->$sortby <=> $a->$sortby or $a->subname cmp $b->subname }
values %$subs_unsorted;
#don't show subs that were never called
my @subs = grep { $_->calls > 0 } @all_subs if !$fi;
my $max_pkg_name_len = max(map { length($_->package) } @subs);
my $output;
$output .= "Name, File location, Time, Avg. Time, Own Time, Invocation Count, Level\n";
my $profiler_active = $profile->{attribute}{profiler_active};
for my $sub (@subs) {
$output .= sprintf ("%s, %s, %.3f, %.3f, %.3f, %d, %d\n",
$sub->subname,
$sub->fileinfo->filename,
$sub->incl_time * 1000,
0,
$sub->excl_time * 1000,
$sub->calls,
0);
}
return $output;
}
exit 0;
|