Debian Codegraph @

internal/report/synth.go

raw symbols SCIP
1 package reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/
2
3 import (
4 "github.com/google/pprof/profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/"
5 )
6
7 // synthCode assigns addresses to locations without an address.
8 type synthCodescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode# struct {
9 nextscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#next. uint64
10 addrscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#addr. map[*profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Locationscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#]uint64 // Synthesized address assigned to a location
11 }
12
13 func newSynthCodescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/newSynthCode().(mappings []*profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Mappingscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Mapping#) *synthCodescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode# {
14 // Find a larger address than any mapping.
15 s := &synthCodescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#{nextscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#next.: 1}
16 for _, m := range mappings {
17 if s.nextscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#next. < m.Limitscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Mapping#Limit. {
18 s.nextscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#next. = m.Limitscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Mapping#Limit.
19 }
20 }
21 return s
22 }
23
24 // address returns the synthetic address for loc, creating one if needed.
25 func (s *synthCodescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#) addressscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#address().(loc *profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Locationscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#) uint64 {
26 if loc.Addressscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#Address. != 0 {
27 panic("can only synthesize addresses for locations without an address")
28 }
29 if addr, ok := s.addrscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#addr.[loc]; ok {
30 return addr
31 }
32 if s.addrscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#addr. == nil {
33 s.addrscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#addr. = map[*profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Locationscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#]uint64{}
34 }
35 addr := s.nextscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#next.
36 s.nextscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#next.++
37 s.addrscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/synthCode#addr.[loc] = addr
38 return addr
39 }