diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2015-02-19 15:21:05 +0300 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2015-02-19 19:46:20 +0000 |
commit | d384545a4580cf1f6990efee5f0047ec60f4258d (patch) | |
tree | bc953abe7ccadfd9c77ba14d03497d75646ca252 | |
parent | 5dbbb776339fe923293c87b4ccb35673b12c112e (diff) | |
download | go-d384545a4580cf1f6990efee5f0047ec60f4258d.tar.gz go-d384545a4580cf1f6990efee5f0047ec60f4258d.zip |
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>
-rw-r--r-- | src/cmd/pprof/internal/driver/driver.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/pprof/internal/driver/driver.go b/src/cmd/pprof/internal/driver/driver.go index a9f6c844f4..9703bafa63 100644 --- a/src/cmd/pprof/internal/driver/driver.go +++ b/src/cmd/pprof/internal/driver/driver.go @@ -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" + |