diff options
author | Jason Evans <je@facebook.com> | 2010-04-08 02:52:15 (GMT) |
---|---|---|
committer | Jason Evans <je@facebook.com> | 2010-04-08 02:52:15 (GMT) |
commit | af366593a4cd5bc6f111dd6e6492594d7cd1e6cb (patch) | |
tree | d5b2a8beca4f85de62615b8a6246eccd3ec5d393 | |
parent | 7cb5b5ea21951468e707375a79bc632957264f8f (diff) | |
download | jemalloc-af366593a4cd5bc6f111dd6e6492594d7cd1e6cb.zip jemalloc-af366593a4cd5bc6f111dd6e6492594d7cd1e6cb.tar.gz jemalloc-af366593a4cd5bc6f111dd6e6492594d7cd1e6cb.tar.bz2 |
Improve ExtractSymbols (pprof).
Iterated downward through both libraries and PCs. This allows PCs
to resolve even when library address ranges overlap.
-rwxr-xr-x | jemalloc/bin/pprof | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/jemalloc/bin/pprof b/jemalloc/bin/pprof index 73d35dd..e42d3b2 100755 --- a/jemalloc/bin/pprof +++ b/jemalloc/bin/pprof @@ -3682,16 +3682,9 @@ sub ExtractSymbols { # Map each PC value to the containing library my @pcs = (sort { $a cmp $b } keys(%{$pcset})); - my @slibs = (sort {$a->[1] cmp $b->[1]} @{$libs}); - my $bin = shift(@slibs); - if ($bin->[1] == 0) { - # Move binary to end (starts at address 0). - push(@slibs, $bin); - } else { - unshift(@slibs, $bin); - } - my $pc = shift(@pcs); - foreach my $lib (@slibs) { + my $pc = pop(@pcs); + + foreach my $lib (reverse sort {$a->[1] cmp $b->[1]} @{$libs}) { my $libname = $lib->[0]; my $start = $lib->[1]; my $finish = $lib->[2]; @@ -3701,7 +3694,7 @@ sub ExtractSymbols { my $contained = []; while (($pc ge $start) && ($pc le $finish)) { push(@{$contained}, $pc); - $pc = shift(@pcs); + $pc = pop(@pcs); if (!defined $pc) { last; } |