github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/convert/pprof/streaming/structs.go (about) 1 package streaming 2 3 import ( 4 "github.com/pyroscope-io/pyroscope/pkg/storage/segment" 5 "github.com/pyroscope-io/pyroscope/pkg/util/arenahelper" 6 ) 7 8 var ( 9 profileIDLabel = []byte(segment.ProfileIDLabelName) 10 ) 11 12 type valueType struct { 13 Type int64 14 unit int64 15 16 resolvedType string 17 resolvedUnit string 18 } 19 type function struct { 20 id uint64 21 name int32 22 filename int32 23 } 24 25 type location struct { 26 id uint64 27 // packed from << 32 | to into values 28 linesRef uint64 29 } 30 31 type line struct { 32 functionID uint64 33 line int64 34 } 35 36 // from,to into profile buffer 37 type istr uint64 38 39 type sample struct { 40 tmpValues []int64 41 // k<<32|v 42 //type labelPacked uint64 43 tmpLabels []uint64 44 tmpStack [][]byte 45 stackHashes []uint64 46 tmpStackLoc []uint64 47 //todo rename - remove tmp prefix 48 } 49 50 func (s *sample) reset(a arenahelper.ArenaWrapper) { 51 // 64 is max pc for golang + speculative number of inlines 52 if s.tmpStack == nil { 53 s.tmpStack = arenahelper.MakeSlice[[]byte](a, 0, 64+8) 54 s.tmpStackLoc = arenahelper.MakeSlice[uint64](a, 0, 64+8) 55 s.tmpValues = arenahelper.MakeSlice[int64](a, 0, 4) 56 s.tmpLabels = arenahelper.MakeSlice[uint64](a, 0, 4) 57 } else { 58 s.tmpStack = s.tmpStack[:0] 59 s.tmpStackLoc = s.tmpStackLoc[:0] 60 s.tmpValues = s.tmpValues[:0] 61 s.tmpLabels = s.tmpLabels[:0] 62 } 63 }