From: Tim Bunce Date: Thu, 27 Sep 2012 15:24:21 +0000 (+0900) Subject: Fix for scalar attr and assorted clenups X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=47a0d085e858e71a2244589866c6c34ad7cdf89d;p=p5sagit%2FDevel-Size.git Fix for scalar attr and assorted clenups --- diff --git a/static/MemView.pl b/static/MemView.pl index c5eaaf9..faf5753 100755 --- a/static/MemView.pl +++ b/static/MemView.pl @@ -39,7 +39,6 @@ get '/jit_tree/:id/:depth' => sub { my $id = $self->stash('id'); my $depth = $self->stash('depth'); - warn "jit_tree $id $depth"; my $node_tree = _fetch_node_tree($id, $depth); my $jit_tree = _transform_node_tree($node_tree, sub { my ($node) = @_; @@ -70,7 +69,7 @@ sub _fetch_node_tree { $node->{$_} += 0 for (qw(child_count kids_node_count kids_size self_size)); $node->{leaves} = $j->decode(delete $node->{leaves_json}); $node->{attr} = $j->decode(delete $node->{attr_json}); - $node->{name} .= " ->" if $node->{type} == 2 && $node->{name}; + $node->{name} .= "->" if $node->{type} == 2 && $node->{name}; if ($node->{child_ids}) { my @child_ids = split /,/, $node->{child_ids}; @@ -98,7 +97,7 @@ sub _fetch_node_tree { $dst->{$k} = $src->{$k}; } } - else { # ARRAY eg NPattr_PADNAME: {attr}{2}[$val] = $name + elsif (ref $src eq 'ARRAY') { # eg NPattr_PADNAME: {attr}{2}[$val] = $name my $dst = $child->{attr}{$attr_type} ||= []; my $idx = @$src; while (--$idx >= 0) { @@ -107,6 +106,11 @@ sub _fetch_node_tree { $dst->[$idx] = $src->[$idx]; } } + else { # assume scalar + warn "Node $child->{id} attr $attr_type=$child->{attr}{$attr_type} overwritten by $src\n" + if exists $child->{attr}{$attr_type}; + $child->{attr}{$attr_type} = $src; + } } $child->{leaves}{$_} += $node->{leaves}{$_} @@ -173,7 +177,7 @@ Welcome to the Mojolicious real-time web framework!

Perl Memory TreeMap

- Clicking on a node will show a new TreeMap with the contents of that node.

+ Click on a node to zoom in.

Go to Parent