Author: tim.bunce
Date: Mon Dec  1 03:18:06 2008
New Revision: 636

Modified:
    trunk/bin/nytprofhtml

Log:
Report merged subs properly.
try (unsuccessfully) to get tablesorter to perform decending initial sorts  
when a column if first clicked.


Modified: trunk/bin/nytprofhtml
==============================================================================
--- trunk/bin/nytprofhtml       (original)
+++ trunk/bin/nytprofhtml       Mon Dec  1 03:18:06 2008
@@ -213,8 +213,17 @@
              sprintf("%.1f%%", $sub->incl_time/$profiler_duration*100)
          );

+        my @hints;
+        push @hints, 'xsub' if $sub->is_xsub;
+
          # package and subname
          my $subname = $sub->subname;
+        if (ref $subname) { # subs have been merged
+            warn "[EMAIL PROTECTED]";
+            push @hints, sprintf "merge of %d subs", scalar @$subname;
+            $subname = $subname->[0];
+        }
+
          my ($pkg, $subr) = ($subname =~ /^(.*::)(.*?)$/) ? ($1, $2) : ('',  
$subname);

          # remove OWN filename from eg __ANON__[(eval  
3)[/long/path/name.pm:99]:53]
@@ -229,9 +238,9 @@
          $sub_links .= sprintf(qq{<span style="display:  
none;">%s::%s</span>}, $pkg, $subr);

          my $href = $reporter->href_for_sub($subname);
-        $sub_links .= sprintf(qq{%*s<a %s>%s</a>%s</span></td>},
-            $max_pkg_name_len+2, $pkg, $href, $subr, $sub->is_xsub ? "  
(xsub)" : ""
-        );
+        $sub_links .= sprintf qq{%*s<a %s>%s</a>%s</span></td>},
+            $max_pkg_name_len+2, $pkg, $href, $subr,
+            (@hints) ? "(".join(", ",@hints).")" : "";

          $sub_links .= "</tr>\n";
      }
@@ -448,6 +457,8 @@
              my $fi = $profile->fileinfo_of($fid);

              my @subnames = $profile->subname_at_file_line($fid, $line);
+            ref $_ and $_ = sprintf "%s (merge of %d subs)", $_->[0],  
scalar @$_
+                for @subnames;
              my $subname = (@subnames) ? " by " . join(" or ",  
@subnames) : "";
              my $avg_time =
                  ($count <= 1)
@@ -605,7 +616,7 @@
      print OUT subroutine_table($profile, 0, $max_subs, undef);
      if ($all_subs > $max_subs) {
          print OUT sprintf qq{<div class="table_footer">
-            For more information see <a href="%s">all %d subroutines</a>  
(sortable)
+            See <a href="%s">all %d subroutines</a>
              </div>
          }, "index-subs-excl.html", $all_subs;
      }
@@ -944,6 +955,9 @@
      <script type="text/javascript"  
src="jquery.tablesorter.min.js"></script>
      <link rel="stylesheet" type="text/css"  
href="style.tablesorter.css"></link>
      <script type="text/javascript">
+    // when a column is first clicked on to sort it, use descending order
+    // XXX doesn't seem to work (and not just because the tablesorter  
formatSortingOrder() is broken)
+    \$.tablesorter.defaults.sortInitialOrder = "desc";
      // add parser through the tablesorter addParser method
      \$.tablesorter.addParser({
          id: 'fmt_time',   // name of this parser

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