summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2016-01-30 03:59:06 (GMT)
committerJason Evans <je@fb.com>2016-01-30 03:59:06 (GMT)
commitd1acd1bea9bc2735b53ac68fa98891cab8c71d02 (patch)
treec1364aa688676eed23ffe2604112cbe9e9adc6f3
parentf459d5a2034e733eab74cc9b029dfec2ff13b196 (diff)
downloadjemalloc-d1acd1bea9bc2735b53ac68fa98891cab8c71d02.zip
jemalloc-d1acd1bea9bc2735b53ac68fa98891cab8c71d02.tar.gz
jemalloc-d1acd1bea9bc2735b53ac68fa98891cab8c71d02.tar.bz2
Pass retain and exclude parameters to /pprof/symbol.
Pass the retain and exclude parameters to the /pprof/symbol pprof server endpoint so that the server has the opportunity to optimize which symbols it looks up and/or returns mappings for.
-rw-r--r--bin/jeprof.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/jeprof.in b/bin/jeprof.in
index dfd9195..42087fc 100644
--- a/bin/jeprof.in
+++ b/bin/jeprof.in
@@ -3385,6 +3385,27 @@ sub ReadSymbols {
return $map;
}
+sub URLEncode {
+ my $str = shift;
+ $str =~ s/([^A-Za-z0-9\-_.!~*'()])/ sprintf "%%%02x", ord $1 /eg;
+ return $str;
+}
+
+sub AppendSymbolFilterParams {
+ my $url = shift;
+ my @params = ();
+ if ($main::opt_retain ne '') {
+ push(@params, sprintf("retain=%s", URLEncode($main::opt_retain)));
+ }
+ if ($main::opt_exclude ne '') {
+ push(@params, sprintf("exclude=%s", URLEncode($main::opt_exclude)));
+ }
+ if (scalar @params > 0) {
+ $url = sprintf("%s?%s", $url, join("&", @params));
+ }
+ return $url;
+}
+
# Fetches and processes symbols to prepare them for use in the profile output
# code. If the optional 'symbol_map' arg is not given, fetches symbols from
# $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
@@ -3409,9 +3430,11 @@ sub FetchSymbols {
my $command_line;
if (join(" ", @URL_FETCHER) =~ m/\bcurl -s/) {
$url = ResolveRedirectionForCurl($url);
+ $url = AppendSymbolFilterParams($url);
$command_line = ShellEscape(@URL_FETCHER, "-d", "\@$main::tmpfile_sym",
$url);
} else {
+ $url = AppendSymbolFilterParams($url);
$command_line = (ShellEscape(@URL_FETCHER, "--post", $url)
. " < " . ShellEscape($main::tmpfile_sym));
}