MCPcopy Create free account
hub / github.com/google/pprof / key

Method key

profile/merge.go:318–338  ·  view source on GitHub ↗

key generates locationKey to be used as a key for maps.

()

Source from the content-addressed store, hash-verified

316
317// key generates locationKey to be used as a key for maps.
318func (l *Location) key() locationKey {
319 key := locationKey{
320 addr: l.Address,
321 isFolded: l.IsFolded,
322 }
323 if l.Mapping != nil {
324 // Normalizes address to handle address space randomization.
325 key.addr -= l.Mapping.Start
326 key.mappingID = l.Mapping.ID
327 }
328 lines := make([]string, len(l.Line)*3)
329 for i, line := range l.Line {
330 if line.Function != nil {
331 lines[i*2] = strconv.FormatUint(line.Function.ID, 16)
332 }
333 lines[i*2+1] = strconv.FormatInt(line.Line, 16)
334 lines[i*2+2] = strconv.FormatInt(line.Column, 16)
335 }
336 key.lines = strings.Join(lines, "|")
337 return key
338}
339
340type locationKey struct {
341 addr, mappingID uint64

Callers 1

mapLocationMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected