http://code.google.com/p/perl-devel-nytprof/source/detail?r=999
Modified:
/trunk/Changes
/trunk/bin/nytprofcg
/trunk/bin/nytprofcsv
=======================================
--- /trunk/Changes Thu Dec 24 06:40:14 2009
+++ /trunk/Changes Fri Dec 25 11:09:40 2009
@@ -13,6 +13,11 @@
add "calls N subs" to treemap mouseover box
string eval merging - must allow at least viewing of source for called
subs defined in a nested eval
+=head2 Changes in Devel::NYTProf 3.01
+
+ Added documentation to nytprofcg.
+ Minor updates to nytprofcsv documentation.
+
=head2 Changes in Devel::NYTProf 3.00 (svn r998) 24th Dec 2009
Note: The file format has changed. Old files can't be read.
=======================================
--- /trunk/bin/nytprofcg Wed Jul 15 04:53:40 2009
+++ /trunk/bin/nytprofcg Fri Dec 25 11:09:40 2009
@@ -9,15 +9,22 @@
###########################################################
use warnings;
use strict;
-use Devel::NYTProf::Data;
+
use Getopt::Long;
+use Devel::NYTProf::Data;
+
+
my %opt = (
file => 'nytprof.out',
out => 'nytprof.callgrind',
);
-process_cli();
+GetOptions( \%opt, qw/file|f=s out|o=s help|h/ )
+ or usage();
+
+usage() if $opt{help};
+
print "Reading $opt{file} ...\n";
@@ -48,7 +55,7 @@
print $fh 'fl='.( $fi ? $fi->filename : "Unknown").$/;
print $fh 'fn='.$sub->subname.$/;
- print $fh join(' ',$sub->first_line, int($sub->excl_time *
1000000)).$/;
+ print $fh join(' ',$sub->first_line, int($sub->excl_time *
1_000_000)).$/;
print $fh $/;
my @callers;
@@ -90,37 +97,45 @@
# calls=(Call Count) (Destination position)
# (Source position) (Inclusive cost of call)
print $fh "calls=$count ".$sub->first_line.$/;
- print $fh "$line ".int(1000000 * $incl_time).$/;
+ print $fh "$line ".int(1_000_000 * $incl_time).$/;
print $fh $/;
}
}
-
-sub process_cli {
- GetOptions( \%opt, qw/file|f=s out|o=s help|h/ )
- or do {
- usage();
- exit 1;
- };
-
- if ( defined( $opt{help} ) ) {
- usage();
- exit;
- }
-}
sub usage {
- print <<END
+ print <<END;
usage: [perl] nytprofcg [opts]
- --file <file>, -f <file> Use the specified file as Devel::NYTProf
database
- file. [default: ./nytprof.out]
- --out <dir>, -o <dir> Place generated files here [default: ./nytprof]
- --delete, -d Delete the old output [uses --out]
+ --file <file>, -f <file> Specify NYTProf data file [default: nytprof.out]
+ --out <file>, -o <file> Specify output file [default: nytprof.callgrind]
--help, -h Print this message
This script of part of the Devel::NYTProf distribution.
Released under the same terms as Perl 5.8.0
See http://search.cpan.org/dist/Devel-NYTProf/
END
+ exit 1;
}
__END__
+
+=head1 NAME
+
+nytprofcg - Convert an NYTProf profile into Callgrind format
+
+=head1 SYNOPSIS
+
+ $ nytprofcg --file=nytprof.out --out=nytprof.callgrind
+
+ $ nytprofcg # same as above
+
+=head1 DESCRIPTION
+
+Reads a profile data file generated by Devel::NYTProf and writes out the
+subroutine call graph information it contains in Callgrind format.
+
+The output Callgrind file can be loaded into the C<kcachegrind> GUI for
+interactive exploration.
+
+For more information see
L<http://kcachegrind.sourceforge.net/html/Home.html>
+
+=cut
=======================================
--- /trunk/bin/nytprofcsv Thu Dec 24 06:40:14 2009
+++ /trunk/bin/nytprofcsv Fri Dec 25 11:09:40 2009
@@ -146,11 +146,13 @@
A bit of history and a shameless plug...
-NYTProf stands for 'New York Times Profiler'. Indeed, this module was
developed
-by The New York Times Co. to help our developers quickly identify
bottlenecks in
-large Perl applications. The NY Times loves Perl and we hope the
community will benefit from our work as much as we have from theirs.
-
-Please visit L<http://open.nytimes.com>, our open source blog to see what
we are up to, L<http://code.nytimes.com> to see some of our open projects
and then
+NYTProf stands for 'New York Times Profiler'. Indeed, the original version
of this
+module was developed by The New York Times Co. to help our developers
quickly
+identify bottlenecks in large Perl applications. The NY Times loves Perl
and
+we hope the community will benefit from our work as much as we have from
theirs.
+
+Please visit L<http://open.nytimes.com>, our open source blog to see what
we are
+up to, L<http://code.nytimes.com> to see some of our open projects and then
check out L<htt://nytimes.com> for the latest news!
=head1 DESCRIPTION