Revision: 1395
Author: [email protected]
Date: Tue Nov  9 21:17:52 2010
Log: Avoid undef warnings for lines with no time/call stats
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1395

Modified:
 /trunk/bin/nytprofhtml
 /trunk/lib/Devel/NYTProf/Util.pm

=======================================
--- /trunk/bin/nytprofhtml      Tue Nov  9 14:58:56 2010
+++ /trunk/bin/nytprofhtml      Tue Nov  9 21:17:52 2010
@@ -461,7 +461,7 @@
         "<tr>$l",
determine_severity($stats_for_line->{'calls'}, $stats_for_file->{'calls'}), determine_severity($stats_for_line->{'time'}, $stats_for_file->{'time'}, 1,
-            \sprintf("Avg %s",fmt_time($stats_for_line->{'time/call'}))),
+ \sprintf("Avg %s", fmt_time($stats_for_line->{'time/call'})| |'--' )), determine_severity($stats_for_line->{'subcall_count'}, $stats_for_file->{subcall_count}, 0), determine_severity($stats_for_line->{'subcall_time'}, $stats_for_file->{subcall_time}, 1),
         $s, "</tr>\n";
=======================================
--- /trunk/lib/Devel/NYTProf/Util.pm    Tue Nov  9 15:00:51 2010
+++ /trunk/lib/Devel/NYTProf/Util.pm    Tue Nov  9 21:17:52 2010
@@ -176,6 +176,7 @@
 sub fmt_time {
     my ($sec, $width) = @_;
     $width = '' unless defined $width;
+    return undef if not defined $sec;
return '-'.fmt_time(-$sec, $width) if $sec < 0; # negative value, can happen
     return sprintf $fmt_time_opt, $sec if $fmt_time_opt;
     return sprintf "%$width.0fs", 0    unless $sec;

--
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