Revision: 1026
Author: tim.bunce
Date: Thu Jan 21 04:07:11 2010
Log: If src not available then pad with blank lines so at least the data will be shown.
Updated Changes.

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1026

Modified:
 /trunk/Changes
 /trunk/lib/Devel/NYTProf/Reader.pm

=======================================
--- /trunk/Changes      Mon Jan 11 13:25:54 2010
+++ /trunk/Changes      Thu Jan 21 04:07:11 2010
@@ -15,16 +15,20 @@

 =head2 Changes in Devel::NYTProf 3.02

-  Fixed handling of usecputime=1 option
-
-XXX Fixed one problem but results are *10 on my mac.
+XXX Fixed one problem with usecputime=1 option but results are *10 on my mac.
 XXX Needs tests.

+  Fixed handling of usecputime=1 option
+  Fixed handling of assignment of XS subs to files
+    in some edge cases thanks to Nicholas Clark.
+
   Added high-resolution (100ns) timer for Mac OS X
     thanks to Markus Peter.
+  Added assorted optimizations thanks to Nicholas Clark.

   Changed subroutine profiler to be slightly more efficient.
   Changed some tests to be more informative on failure.
+  Changed nytprofhtml to be smarter when source isn't available.

   Updated docs to include a note about timing on Windows.
   Updated docs to include a section about making NYTProf faster.
=======================================
--- /trunk/lib/Devel/NYTProf/Reader.pm  Mon Jan  4 12:33:17 2010
+++ /trunk/lib/Devel/NYTProf/Reader.pm  Thu Jan 21 04:07:11 2010
@@ -18,7 +18,7 @@
 use Carp;
 use Config;

-use List::Util qw(sum);
+use List::Util qw(sum max);

 use Devel::NYTProf::Data;
 use Devel::NYTProf::Util qw(
@@ -413,11 +413,23 @@
             $src_lines = [ $msg ];
             $LINE = 0;
         }
+
+ # if we don't have source code, still pad out the lines to match the data we have
+        # so the report page isn't completely useless
+        if (@$src_lines <= 1) {
+            my @interesting_lines = grep { m/^\d+$/ } (
+                keys %$subcalls_at_line,
+                keys %$subs_defined_hash,
+                keys %stats_by_line
+            );
+ $src_lines->[$_] ||= '' for 1..max(@interesting_lines); # grow array
+        }

         my $line_sub = $self->{mk_report_source_line}
             or die "mk_report_source_line not set";

-        while ( my $line = shift @$src_lines ) {
+        while ( @$src_lines ) {
+            my $line = shift @$src_lines;
             chomp $line;

             if ($line =~ m/^\# \s* line \s+ (\d+) \b/x) {
-- 
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to