Skip to content

Commit

Permalink
adding cache of addr2line results when --inline is on
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-konczak-cs-put committed Mar 27, 2021
1 parent a258e78 commit d45f620
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion stackcollapse-perf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,14 @@ sub remember_stack {
$annotate_kernel = $annotate_jit = 1;
}

my %inlineCache;

# for the --inline option
sub inline {
my ($pc, $mod) = @_;

return $inlineCache{$pc}{$mod} if defined($inlineCache{$pc}{$mod});

# capture addr2line output
my $a2l_output = `addr2line -a $pc -e $mod -i -f -s -C`;

Expand All @@ -149,7 +153,15 @@ sub inline {
}
}

return join(";", @fullfunc);
my $result = join ";" , @fullfunc;

if (defined($inlineCache{$pc})){
$inlineCache{$pc}{$mod}=$result;
} else {
$inlineCache{$pc} = {$mod => $result};
}

return $result;
}

my @stack;
Expand Down

0 comments on commit d45f620

Please sign in to comment.