aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/pprof
diff options
context:
space:
mode:
authorHana (Hyang-Ah) Kim <hyangah@gmail.com>2019-11-05 18:07:10 +0900
committerHyang-Ah Hana Kim <hyangah@gmail.com>2019-11-08 04:44:53 +0000
commit45b4ed7577f87c9c88271e803e76f2d81b0f1f77 (patch)
tree6ae3351fa20a47881a09dd40e1bdff55da2a376d /src/runtime/pprof
parente25de44ef2990a1aadf6c5ece09e41cf158461d7 (diff)
downloadgo-45b4ed7577f87c9c88271e803e76f2d81b0f1f77.tar.gz
go-45b4ed7577f87c9c88271e803e76f2d81b0f1f77.zip
runtime/pprof: delete unused locForPC
Change-Id: Ie4754fefba6057b1cf558d0096fe0e83355f8eff Reviewed-on: https://go-review.googlesource.com/c/go/+/205098 TryBot-Result: Gobot Gobot <gobot@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r--src/runtime/pprof/proto.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go
index bc4697a8ab..c269c3a652 100644
--- a/src/runtime/pprof/proto.go
+++ b/src/runtime/pprof/proto.go
@@ -239,91 +239,6 @@ func allFrames(addr uintptr) ([]runtime.Frame, symbolizeFlag) {
return ret, symbolizeResult
}
-// locForPC returns the location ID for addr.
-// addr must a return PC or 1 + the PC of an inline marker. This returns the location of the corresponding call.
-// It may emit to b.pb, so there must be no message encoding in progress.
-func (b *profileBuilder) locForPC(addr uintptr) uint64 {
- if loc, ok := b.locs[addr]; ok {
- return loc.id
- }
-
- // Expand this one address using CallersFrames so we can cache
- // each expansion. In general, CallersFrames takes a whole
- // stack, but in this case we know there will be no skips in
- // the stack and we have return PCs anyway.
- frames := runtime.CallersFrames([]uintptr{addr})
- frame, more := frames.Next()
- if frame.Function == "runtime.goexit" {
- // Short-circuit if we see runtime.goexit so the loop
- // below doesn't allocate a useless empty location.
- return 0
- }
-
- symbolizeResult := lookupTried
- if frame.PC == 0 || frame.Function == "" || frame.File == "" || frame.Line == 0 {
- symbolizeResult |= lookupFailed
- }
-
- if frame.PC == 0 {
- // If we failed to resolve the frame, at least make up
- // a reasonable call PC. This mostly happens in tests.
- frame.PC = addr - 1
- }
-
- // We can't write out functions while in the middle of the
- // Location message, so record new functions we encounter and
- // write them out after the Location.
- type newFunc struct {
- id uint64
- name, file string
- }
- newFuncs := make([]newFunc, 0, 8)
-
- id := uint64(len(b.locs)) + 1
- b.locs[addr] = locInfo{id: id, pcs: []uintptr{addr}}
- start := b.pb.startMessage()
- b.pb.uint64Opt(tagLocation_ID, id)
- b.pb.uint64Opt(tagLocation_Address, uint64(frame.PC))
- for frame.Function != "runtime.goexit" {
- // Write out each line in frame expansion.
- funcID := uint64(b.funcs[frame.Function])
- if funcID == 0 {
- funcID = uint64(len(b.funcs)) + 1
- b.funcs[frame.Function] = int(funcID)
- newFuncs = append(newFuncs, newFunc{funcID, frame.Function, frame.File})
- }
- b.pbLine(tagLocation_Line, funcID, int64(frame.Line))
- if !more {
- break
- }
- frame, more = frames.Next()
- }
- for i := range b.mem {
- if b.mem[i].start <= addr && addr < b.mem[i].end || b.mem[i].fake {
- b.pb.uint64Opt(tagLocation_MappingID, uint64(i+1))
-
- m := b.mem[i]
- m.funcs |= symbolizeResult
- b.mem[i] = m
- break
- }
- }
- b.pb.endMessage(tagProfile_Location, start)
-
- // Write out functions we found during frame expansion.
- for _, fn := range newFuncs {
- start := b.pb.startMessage()
- b.pb.uint64Opt(tagFunction_ID, fn.id)
- b.pb.int64Opt(tagFunction_Name, b.stringIndex(fn.name))
- b.pb.int64Opt(tagFunction_SystemName, b.stringIndex(fn.name))
- b.pb.int64Opt(tagFunction_Filename, b.stringIndex(fn.file))
- b.pb.endMessage(tagProfile_Function, start)
- }
-
- b.flush()
- return id
-}
-
type locInfo struct {
// location id assigned by the profileBuilder
id uint64