mirror of https://github.com/golang/go.git
cmd/pprof: add -runtime flag
The flag disables stripping of runtime frames in profiles.
This is useful when analyzing runtime itself.
Before:
$ go tool pprof --text --alloc_objects --lines fmt.test /tmp/mprof
flat flat% sum% cum cum%
2768 79.65% 79.65% 32768 79.65% fmt_test.TestComplexFormatting fmt/fmt_test.go:744
6554 15.93% 95.58% 6554 15.93% regexp/syntax.(*compiler).rune regexp/syntax/compile.go:267
1820 4.42% 100% 1820 4.42% runtime.malg runtime/proc1.go:1977
After:
$ go tool pprof --text --alloc_objects --lines --runtime fmt.test /tmp/mprof
flat flat% sum% cum cum%
32768 79.65% 79.65% 32768 79.65% runtime.convT2E runtime/iface.go:139
6554 15.93% 95.58% 6554 15.93% runtime.growslice runtime/slice.go:89
1820 4.42% 100% 1820 4.42% runtime.malg runtime/proc1.go:1977
Change-Id: If468dfa5c5bbd0809c45a58d912d3115fac009ed
Reviewed-on: https://go-review.googlesource.com/5291
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
5dbbb77633
commit
d384545a45
|
|
@ -106,7 +106,9 @@ func PProf(flagset plugin.FlagSet, fetch plugin.Fetcher, sym plugin.Symbolizer,
|
|||
return err
|
||||
}
|
||||
|
||||
prof.RemoveUninteresting()
|
||||
if !*f.flagRuntime {
|
||||
prof.RemoveUninteresting()
|
||||
}
|
||||
|
||||
if *f.flagInteractive {
|
||||
return interactive(prof, obj, ui, f)
|
||||
|
|
@ -445,6 +447,7 @@ type flags struct {
|
|||
flagNodeFraction *float64 // Hide nodes below <f>*total
|
||||
flagEdgeFraction *float64 // Hide edges below <f>*total
|
||||
flagTrim *bool // Set to false to ignore NodeCount/*Fraction
|
||||
flagRuntime *bool // Show runtime call frames in memory profiles
|
||||
flagFocus *string // Restricts to paths going through a node matching regexp
|
||||
flagIgnore *string // Skips paths going through any nodes matching regexp
|
||||
flagHide *string // Skips sample locations matching regexp
|
||||
|
|
@ -640,6 +643,7 @@ func getFlags(flag plugin.FlagSet, overrides commands.Commands, ui plugin.UI) (*
|
|||
flagNodeFraction: flag.Float64("nodefraction", 0.005, "Hide nodes below <f>*total"),
|
||||
flagEdgeFraction: flag.Float64("edgefraction", 0.001, "Hide edges below <f>*total"),
|
||||
flagTrim: flag.Bool("trim", true, "Honor nodefraction/edgefraction/nodecount defaults"),
|
||||
flagRuntime: flag.Bool("runtime", false, "Show runtime call frames in memory profiles"),
|
||||
flagFocus: flag.String("focus", "", "Restricts to paths going through a node matching regexp"),
|
||||
flagIgnore: flag.String("ignore", "", "Skips paths going through any nodes matching regexp"),
|
||||
flagHide: flag.String("hide", "", "Skips nodes matching regexp"),
|
||||
|
|
@ -877,6 +881,7 @@ var usageMsg = "Output file parameters (for file-based output formats):\n" +
|
|||
" -contentions Display number of delays at each region\n" +
|
||||
" -mean_delay Display mean delay at each region\n" +
|
||||
"Filtering options:\n" +
|
||||
" -runtime Show runtime call frames in memory profiles\n" +
|
||||
" -focus=r Restricts to paths going through a node matching regexp\n" +
|
||||
" -ignore=r Skips paths going through any nodes matching regexp\n" +
|
||||
" -tagfocus=r Restrict to samples tagged with key:value matching regexp\n" +
|
||||
|
|
|
|||
Loading…
Reference in New Issue