summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alk@tut.by>2014-12-20 19:53:12 -0800
committerAliaksey Kandratsenka <alk@tut.by>2014-12-28 15:35:54 -0800
commit812ab1ee7e4365e6a9568834c7e8f4aef10018fb (patch)
treedbc8122128984524cf1f9974a3fe92a960a67608
parente6e78315e4761ad121a5eeb4fdffe3571d81ac17 (diff)
downloadgperftools-812ab1ee7e4365e6a9568834c7e8f4aef10018fb.tar.gz
pprof: eliminate duplicate top frames if dropping signal frames
In cpu profiles that had parts of signal handler we could have situation like that: * PC * signal handler frame * PC Specifically when capturing stacktraces via libunwind. For such stacktraces pprof used to draw self-cycle in functions confusing everybody. Given that me might have a number of such profiles in the wild it makes sense to treat that duplicate PC issue.
-rwxr-xr-xsrc/pprof8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pprof b/src/pprof
index 30dbccf..e231718 100755
--- a/src/pprof
+++ b/src/pprof
@@ -72,6 +72,7 @@ use strict;
use warnings;
use Getopt::Long;
use Cwd;
+use POSIX;
my $PPROF_VERSION = "2.0";
@@ -2982,7 +2983,14 @@ sub RemoveUninterestingFrames {
foreach my $k (keys(%{$profile})) {
my $count = $profile->{$k};
my @addrs = split(/\n/, $k);
+ my $topaddr = POSIX::strtoul($addrs[0], 16);
splice @addrs, 1, 1;
+ if ($#addrs > 1) {
+ my $subtopaddr = POSIX::strtoul($addrs[1], 16);
+ if ($subtopaddr + 1 == $topaddr) {
+ splice @addrs, 1, 1;
+ }
+ }
my $reduced_path = join("\n", @addrs);
AddEntry($result, $reduced_path, $count);
}