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

Method key

profile/merge.go:386–410  ·  view source on GitHub ↗

key generates encoded strings of Mapping to be used as a key for maps.

()

Source from the content-addressed store, hash-verified

384// key generates encoded strings of Mapping to be used as a key for
385// maps.
386func (m *Mapping) key() mappingKey {
387 // Normalize addresses to handle address space randomization.
388 // Round up to next 4K boundary to avoid minor discrepancies.
389 const mapsizeRounding = 0x1000
390
391 size := m.Limit - m.Start
392 size = size + mapsizeRounding - 1
393 size = size - (size % mapsizeRounding)
394 key := mappingKey{
395 size: size,
396 offset: m.Offset,
397 }
398
399 switch {
400 case m.BuildID != "":
401 key.buildIDOrFile = m.BuildID
402 case m.File != "":
403 key.buildIDOrFile = m.File
404 default:
405 // A mapping containing neither build ID nor file name is a fake mapping. A
406 // key with empty buildIDOrFile is used for fake mappings so that they are
407 // treated as the same mapping during merging.
408 }
409 return key
410}
411
412type mappingKey struct {
413 size, offset uint64

Callers 2

mapMappingMethod · 0.45
mapFunctionMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected