Changeset c4f89cf


Ignore:
Timestamp:
05/28/15 17:09:31 (9 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master
Children:
6520ef5
Parents:
4bd7a88
git-author:
Hal Finkel <hfinkel@…> (05/28/15 17:09:31)
git-committer:
Hal Finkel <hfinkel@…> (05/28/15 17:09:31)
Message:

common nodes correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • memlog2dot

    r4bd7a88 rc4f89cf  
    55my $total_size = 0; 
    66my %roots; 
    7 my @all_nodes; 
     7my %all_nodes; 
    88foreach my $line ( <STDIN> ) { 
    99  chomp($line); 
     
    4646    # print STDERR "parsed: $file_name, $proc_name, $off, $pc, $relpc\n"; 
    4747 
     48    if (!exists $all_nodes{$pc}) { 
     49      $all_nodes{$pc}->{'file_name'} = $file_name; 
     50      $all_nodes{$pc}->{'proc_name'} = $proc_name; 
     51      $all_nodes{$pc}->{'off'} = $off; 
     52      $all_nodes{$pc}->{'pc'} = $pc; 
     53      $all_nodes{$pc}->{'relpc'} = $relpc; 
     54    } 
     55 
    4856    if (!exists $parent->{$pc}) { 
    49       $parent->{$pc}->{'file_name'} = $file_name; 
    50       $parent->{$pc}->{'proc_name'} = $proc_name; 
    51       $parent->{$pc}->{'off'} = $off; 
    52       $parent->{$pc}->{'pc'} = $pc; 
    53       $parent->{$pc}->{'relpc'} = $relpc; 
    54  
    55       push(@all_nodes, $parent->{$pc}); 
     57      $parent->{$pc} = $all_nodes{$pc}; 
    5658    } 
    5759 
     
    141143my %skipped; 
    142144 
    143 foreach my $node (@all_nodes) { 
     145foreach my $pc (keys %all_nodes) { 
     146  my $node = $all_nodes{$pc}; 
    144147  my $name = get_name($node); 
    145148 
    146149  my $local_size = $node->{'size'}; 
    147150  if ($local_size * 1.0 / $total_size < $skip_frac) { 
    148     $skipped{$node->{'pc'}} = 1; 
     151    $skipped{$pc} = 1; 
    149152    next; 
    150153  } 
     
    156159 
    157160  printf("N%s [label=\"%s\\n%s\", shape=box,fontsize=%.1f%s];\n", 
    158     $node->{'pc'}, $name, format_bytes($local_size), $fs); 
     161    $pc, $name, format_bytes($local_size), $fs); 
    159162} 
    160163 
    161 foreach my $node (@all_nodes) { 
     164foreach my $pc (keys %all_nodes) { 
     165  my $node = $all_nodes{$pc}; 
     166 
    162167  my $local_size = $node->{'size'}; 
    163   if ($skipped{$node->{'pc'}}) { 
     168  if ($skipped{$pc}) { 
    164169    next; 
    165170  } 
     
    177182 
    178183    printf("N%s -> N%s [label=\"%s\", weight=%d, style=\"%s\"];\n", 
    179       $node->{'pc'}, $cpc, format_bytes($child_size), $weight, $style); 
     184      $pc, $cpc, format_bytes($child_size), $weight, $style); 
    180185  } 
    181186} 
Note: See TracChangeset for help on using the changeset viewer.