Commit bcf88de5 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

pprof: filter out runtime.settype and fix --svg mode to produce valid XML

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6642043
parent 08d66439
...@@ -634,7 +634,7 @@ sub Main() { ...@@ -634,7 +634,7 @@ sub Main() {
# (only matters when --heapcheck is given but we must be # (only matters when --heapcheck is given but we must be
# compatible with old branches that did not pass --heapcheck always): # compatible with old branches that did not pass --heapcheck always):
if ($total != 0) { if ($total != 0) {
printf("Total: %s %s\n", Unparse($total), Units()); Infof("Total: %s %s\n", Unparse($total), Units());
} }
PrintText($symbols, $flat, $cumulative, $total, -1); PrintText($symbols, $flat, $cumulative, $total, -1);
} elsif ($main::opt_raw) { } elsif ($main::opt_raw) {
...@@ -931,7 +931,7 @@ sub ProcessProfile { ...@@ -931,7 +931,7 @@ sub ProcessProfile {
if ($focus ne '') { if ($focus ne '') {
$profile = FocusProfile($symbols, $profile, $focus); $profile = FocusProfile($symbols, $profile, $focus);
my $focus_count = TotalProfile($profile); my $focus_count = TotalProfile($profile);
printf("After focusing on '%s': %s %s of %s (%0.1f%%)\n", Infof("After focusing on '%s': %s %s of %s (%0.1f%%)\n",
$focus, $focus,
Unparse($focus_count), Units(), Unparse($focus_count), Units(),
Unparse($total_count), ($focus_count*100.0) / $total_count); Unparse($total_count), ($focus_count*100.0) / $total_count);
...@@ -939,7 +939,7 @@ sub ProcessProfile { ...@@ -939,7 +939,7 @@ sub ProcessProfile {
if ($ignore ne '') { if ($ignore ne '') {
$profile = IgnoreProfile($symbols, $profile, $ignore); $profile = IgnoreProfile($symbols, $profile, $ignore);
my $ignore_count = TotalProfile($profile); my $ignore_count = TotalProfile($profile);
printf("After ignoring '%s': %s %s of %s (%0.1f%%)\n", Infof("After ignoring '%s': %s %s of %s (%0.1f%%)\n",
$ignore, $ignore,
Unparse($ignore_count), Units(), Unparse($ignore_count), Units(),
Unparse($total_count), Unparse($total_count),
...@@ -1115,6 +1115,15 @@ sub PrintSymbolizedProfile { ...@@ -1115,6 +1115,15 @@ sub PrintSymbolizedProfile {
} }
} }
# Print information conditionally filtered out depending on the output
# format.
sub Infof {
my $format = shift;
my @args = @_;
return if $main::opt_svg;
printf($format, @args);
}
# Print text output # Print text output
sub PrintText { sub PrintText {
my $symbols = shift; my $symbols = shift;
...@@ -2638,6 +2647,8 @@ sub RemoveUninterestingFrames { ...@@ -2638,6 +2647,8 @@ sub RemoveUninterestingFrames {
'runtime.makemap_c', 'runtime.makemap_c',
'runtime.makeslice', 'runtime.makeslice',
'runtime.mal', 'runtime.mal',
'runtime.settype',
'runtime.settype_flush',
'runtime.slicebytetostring', 'runtime.slicebytetostring',
'runtime.sliceinttostring', 'runtime.sliceinttostring',
'runtime.stringtoslicebyte', 'runtime.stringtoslicebyte',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment