aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/pprof/pprof.go
diff options
context:
space:
mode:
authorHana (Hyang-Ah) Kim <hyangah@gmail.com>2019-11-04 03:51:25 +0900
committerHyang-Ah Hana Kim <hyangah@gmail.com>2019-11-08 04:08:53 +0000
commite25de44ef2990a1aadf6c5ece09e41cf158461d7 (patch)
treec1fe93626bcc1961f2f29accf9dafe0ed1ed0f5a /src/runtime/pprof/pprof.go
parentf5e89c2214af2c4340d03dc9fd8ca8f507eff3ff (diff)
downloadgo-e25de44ef2990a1aadf6c5ece09e41cf158461d7.tar.xz
runtime/pprof: correct inlined function location encoding for non-CPU profiles
Change-Id: Id270a3477bf1a581755c4311eb12f990aa2260b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/205097 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/pprof/pprof.go')
-rw-r--r--src/runtime/pprof/pprof.go26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go
index 2fc567ef34..a7916bf6fb 100644
--- a/src/runtime/pprof/pprof.go
+++ b/src/runtime/pprof/pprof.go
@@ -386,16 +386,9 @@ func printCountCycleProfile(w io.Writer, countName, cycleName string, scaler fun
count, nanosec := scaler(r.Count, float64(r.Cycles)/cpuGHz)
values[0] = count
values[1] = int64(nanosec)
- locs = locs[:0]
- for _, addr := range r.Stack() {
- // For count profiles, all stack addresses are
- // return PCs, which is what locForPC expects.
- l := b.locForPC(addr)
- if l == 0 { // runtime.goexit
- continue
- }
- locs = append(locs, l)
- }
+ // For count profiles, all stack addresses are
+ // return PCs, which is what appendLocsForStack expects.
+ locs = b.appendLocsForStack(locs[:0], r.Stack())
b.pbSample(values, locs, nil)
}
b.build()
@@ -451,16 +444,9 @@ func printCountProfile(w io.Writer, debug int, name string, p countProfile) erro
var locs []uint64
for _, k := range keys {
values[0] = int64(count[k])
- locs = locs[:0]
- for _, addr := range p.Stack(index[k]) {
- // For count profiles, all stack addresses are
- // return PCs, which is what locForPC expects.
- l := b.locForPC(addr)
- if l == 0 { // runtime.goexit
- continue
- }
- locs = append(locs, l)
- }
+ // For count profiles, all stack addresses are
+ // return PCs, which is what appendLocsForStack expects.
+ locs = b.appendLocsForStack(locs[:0], p.Stack(index[k]))
b.pbSample(values, locs, nil)
}
b.build()