Author: tim.bunce
Date: Tue Jun 30 15:03:52 2009
New Revision: 787

Modified:
    trunk/bin/nytprofhtml
    trunk/lib/Devel/NYTProf/js/jit/Treemap.css

Log:
Don't include subs with 0 time in the treemap.
Assorted tweaks and polish.


Modified: trunk/bin/nytprofhtml
==============================================================================
--- trunk/bin/nytprofhtml       (original)
+++ trunk/bin/nytprofhtml       Tue Jun 30 15:03:52 2009
@@ -271,6 +271,12 @@
  }


+sub subroutine_treemap {
+    my ($profile, $filestr) = @_;
+    return "";
+}
+
+
  sub package_tables {
      my ($profile) = @_;
      my $pkg_html = "";
@@ -386,9 +392,12 @@
      sub {
          my ($profile, $filestr) = @_;

-        my $sub_links = subroutine_table($profile, $filestr, undef, undef);
+        my $sub_table = subroutine_table($profile, $filestr, undef, undef);
+        my $treemap = subroutine_treemap($profile, $filestr);

-        return qq{$sub_links
+        return qq{
+        $sub_table
+        $treemap
        <table border="1" cellpadding="0">
        <thead>
        <tr><th>Line</th><th>Stmts.</th><th>Exclusive<br  
/>Time</th><th>Avg.</th><th class="left_indent_header">Code</th>
@@ -555,7 +564,7 @@

  output_subs_indexpage($reporter, "index-subs-excl.html", 'excl_time');
  output_subs_indexpage($reporter, "index-subs-incl.html", 'incl_time');
-output_package_treemap($reporter, "package-treemap.html");
+output_package_treemappage($reporter, "package-treemap.html");
  output_indexpage($reporter, "index.html");

  output_js_files($reporter);
@@ -646,9 +655,9 @@
          }, "index-subs-excl.html", $all_subs;
      }

-    print OUT file_table($profile, $stats, 1);
+    print OUT q{<br/><a href="package-treemap.html">View as  
treemap</a><br/>};

-    print OUT q{<br/><a href="package-treemap.html">Package  
treemap</a><br/>};
+    print OUT file_table($profile, $stats, 1);

      print OUT package_tables($profile);

@@ -785,21 +794,30 @@

              if (ref $infos eq 'HASH') { # recurse into subpackages
                  push @kids, $node_mapper->($pkg_elem, $infos, $title);
+                next;
              }
-            else { # subs within this package
-                our $color_seqn; # all subs in pkg get same color
-                my $color = $colors[ $color_seqn++ % @colors ];
-
-                push @kids, map { {
-                    id => "n".++$nid,
-                    name => $_->subname_without_package,
-                    data => $leaf_data_sub->($_, $area_sub, $color),
+
+            # subs within this package
+            our $color_seqn; # all subs in pkg get same color
+            my $color = $colors[ $color_seqn++ % @colors ];
+
+            for my $info (@$infos) {
+
+                # don't both including subs that don't have any data
+                # (unless we've not got any subs yet, to avoid problems  
elsewhere)
+                next if $area_sub->($info) <= 0;
+
+                push @kids, {
+                    id => ++$nid."-".$info->subname,
+                    name => $info->subname_without_package,
+                    data => $leaf_data_sub->($info, $area_sub, $color),
                      children => [],
-                } } @$infos;
+                };
              }
          }
-        $n->{data}{'$area'} = sum(map { $_->{data}{'$area'} } @kids)
-            unless defined $n->{data}{'$area'};
+
+        $n->{data}{'$area'} = (@kids) ? sum(map { $_->{data}{'$area'} }  
@kids) : 0
+            if not defined $n->{data}{'$area'};
          $n->{children} = \...@kids;

          return $n;
@@ -825,7 +843,7 @@
  }


-sub output_package_treemap {
+sub output_package_treemappage {
      my ($r, $filename) = @_;
      my $profile = $reporter->{profile};


Modified: trunk/lib/Devel/NYTProf/js/jit/Treemap.css
==============================================================================
--- trunk/lib/Devel/NYTProf/js/jit/Treemap.css  (original)
+++ trunk/lib/Devel/NYTProf/js/jit/Treemap.css  Tue Jun 30 15:03:52 2009
@@ -42,9 +42,7 @@

  #infovis .content {
  }
-
  #infovis .over-content {
-    background-color: teal;
  }

  #infovis .head {
@@ -53,28 +51,23 @@
      font-weight:bold;
      background-color:#dddddd;
  }
-
  #infovis .over-head {
      background-color:#FFFF00;
  }
-
  #infovis .head.in-path {
      background-color:#FFFF00;
  }

-#infovis .body {
-}

  #infovis .leaf {
      display:table-cell;
      vertical-align:middle;
      background-color:white;
-    border:solid 1px #cccccc;
+    border:solid 1px transparent;
  }
-
  #infovis .over-leaf {
-    border:1px solid red;
-    /* outline: 5px solid red; outline-offset: -5px; */
+    /* border:1px solid red; */
+    outline: 2px solid red; outline-offset: -2px;
  }


@@ -86,8 +79,11 @@
      font-family:monospace;
      color: white;
      background-color: black;
-    padding: 5px;
+    opacity: 0.7;
+    padding: 15px;
      border-radius: 5px;
+    -webkit-border-radius: 5px;
+       -moz-border-radius: 5px;
      -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
         -moz-box-shadow: black 5px 5px 5px;
  }

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