| 1 | // Copyright 2022 Google Inc. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/ |
| 16 | |
| 17 | import ( |
| 18 | "crypto/sha256scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha256`/" |
| 19 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/" |
| 20 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 21 | "path/filepathscip-go gomod github.com/golang/go/src go1.24.0 `path/filepath`/" |
| 22 | |
| 23 | "github.com/google/pprof/internal/measurementscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/measurement`/" |
| 24 | "github.com/google/pprof/profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/" |
| 25 | ) |
| 26 | |
| 27 | // StackSet holds a set of stacks corresponding to a profile. |
| 28 | // |
| 29 | // Slices in StackSet and the types it contains are always non-nil, |
| 30 | // which makes Javascript code that uses the JSON encoding less error-prone. |
| 31 | type StackSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet# struct { |
| 32 | Totalscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Total. int64 // Total value of the profile. |
| 33 | Scalescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Scale. float64 // Multiplier to generate displayed value |
| 34 | Typescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Type. string // Profile type. E.g., "cpu". |
| 35 | Unitscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Unit. string // One of "B", "s", "GCU", or "" (if unknown) |
| 36 | Stacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Stacks. []Stackscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack# // List of stored stacks |
| 37 | Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources. []StackSourcescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource# // Mapping from source index to info |
| 38 | reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#report. *Reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report# |
| 39 | } |
| 40 | |
| 41 | // Stack holds a single stack instance. |
| 42 | type Stackscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack# struct { |
| 43 | Valuescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Value. int64 // Total value for all samples of this stack. |
| 44 | Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources. []int // Indices in StackSet.Sources (callers before callees). |
| 45 | } |
| 46 | |
| 47 | // StackSource holds function/location info for a stack entry. |
| 48 | type StackSourcescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource# struct { |
| 49 | FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName. string |
| 50 | FileNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FileName. string |
| 51 | UniqueNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#UniqueName. string // Disambiguates functions with same names |
| 52 | Inlinedscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Inlined. bool // If true this source was inlined into its caller |
| 53 | |
| 54 | // Alternative names to display (with decreasing lengths) to make text fit. |
| 55 | // Guaranteed to be non-empty. |
| 56 | Displayscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Display. []string |
| 57 | |
| 58 | // Places holds the list of stack slots where this source occurs. |
| 59 | // In particular, if [a,b] is an element in Places, |
| 60 | // StackSet.Stacks[a].Sources[b] points to this source. |
| 61 | // |
| 62 | // No stack will be referenced twice in the Places slice for a given |
| 63 | // StackSource. In case of recursion, Places will contain the outer-most |
| 64 | // entry in the recursive stack. E.g., if stack S has source X at positions |
| 65 | // 4,6,9,10, the Places entry for X will contain [S,4]. |
| 66 | Placesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Places. []StackSlotscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot# |
| 67 | |
| 68 | // Combined count of stacks where this source is the leaf. |
| 69 | Selfscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Self. int64 |
| 70 | |
| 71 | // Color number to use for this source. |
| 72 | // Colors with high numbers than supported may be treated as zero. |
| 73 | Colorscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Color. int |
| 74 | } |
| 75 | |
| 76 | // StackSlot identifies a particular StackSlot. |
| 77 | type StackSlotscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot# struct { |
| 78 | Stackscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot#Stack. int // Index in StackSet.Stacks |
| 79 | Posscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot#Pos. int // Index in Stack.Sources |
| 80 | } |
| 81 | |
| 82 | // Stacks returns a StackSet for the profile in rpt. |
| 83 | func (rpt *Reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#) Stacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#Stacks().() StackSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet# { |
| 84 | // Get scale for converting to default unit of the right type. |
| 85 | scale, unit := measurementscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/measurement`/.Scalescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/measurement`/Scale().(1, rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..SampleUnitscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#SampleUnit., "default") |
| 86 | if unit == "default" { |
| 87 | unit = "" |
| 88 | } |
| 89 | if rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..Ratioscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#Ratio. > 0 { |
| 90 | scale *= rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..Ratioscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#Ratio. |
| 91 | } |
| 92 | s := &StackSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#{ |
| 93 | Totalscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Total.: rpt.totalscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#total., |
| 94 | Scalescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Scale.: scale, |
| 95 | Typescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Type.: rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..SampleTypescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#SampleType., |
| 96 | Unitscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Unit.: unit, |
| 97 | Stacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Stacks.: []Stackscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#{}, // Ensure non-nil |
| 98 | Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.: []StackSourcescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#{}, // Ensure non-nil |
| 99 | reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#report.: rpt, |
| 100 | } |
| 101 | s.makeInitialStacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#makeInitialStacks().(rpt) |
| 102 | s.fillPlacesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#fillPlaces().() |
| 103 | return *s |
| 104 | } |
| 105 | |
| 106 | func (s *StackSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#) makeInitialStacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#makeInitialStacks().(rpt *Reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#) { |
| 107 | type key struct { |
| 108 | funcName string |
| 109 | fileName string |
| 110 | line int64 |
| 111 | column int64 |
| 112 | inlined bool |
| 113 | } |
| 114 | srcs := map[key]int{} // Sources identified so far. |
| 115 | seenFunctions := map[string]bool{} |
| 116 | unknownIndex := 1 |
| 117 | |
| 118 | getSrc := func(line profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#, inlined bool) int { |
| 119 | fn := line.Functionscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Function. |
| 120 | if fn == nil { |
| 121 | fn = &profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Functionscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#{Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Name.: fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("?%d?", unknownIndex)} |
| 122 | unknownIndex++ |
| 123 | } |
| 124 | |
| 125 | k := key{fn.Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Name., fn.Filenamescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Filename., line.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Line., line.Columnscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Column., inlined} |
| 126 | if i, ok := srcs[k]; ok { |
| 127 | return i |
| 128 | } |
| 129 | |
| 130 | fileName := trimPathscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/trimPath().(fn.Filenamescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Filename., rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..TrimPathscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#TrimPath., rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..SourcePathscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#SourcePath.) |
| 131 | x := StackSourcescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#{ |
| 132 | FileNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FileName.: fileName, |
| 133 | Inlinedscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Inlined.: inlined, |
| 134 | Placesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Places.: []StackSlotscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot#{}, // Ensure Places is non-nil |
| 135 | } |
| 136 | if fn.Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Name. != "" { |
| 137 | x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName. = addLineInfoscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/addLineInfo().(fn.Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Name., line) |
| 138 | x.Displayscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Display. = shortNameListscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/shortNameList().(x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName.) |
| 139 | x.Colorscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Color. = pickColorscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/pickColor().(packageNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/packageName().(fn.Namescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#Name.)) |
| 140 | } else { // Use file name, e.g., for file granularity display. |
| 141 | x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName. = addLineInfoscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/addLineInfo().(fileName, line) |
| 142 | x.Displayscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Display. = fileNameSuffixesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/fileNameSuffixes().(x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName.) |
| 143 | x.Colorscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Color. = pickColorscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/pickColor().(filepathscip-go gomod github.com/golang/go/src go1.24.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.24.0 `path/filepath`/Dir().(fileName)) |
| 144 | } |
| 145 | |
| 146 | if !seenFunctions[x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName.] { |
| 147 | x.UniqueNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#UniqueName. = x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName. |
| 148 | seenFunctions[x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName.] = true |
| 149 | } else { |
| 150 | // Assign a different name so pivoting picks this function. |
| 151 | x.UniqueNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#UniqueName. = fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprint().(x.FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName., "#", fn.IDscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Function#ID.) |
| 152 | } |
| 153 | |
| 154 | s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources. = append(s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources., x) |
| 155 | srcs[k] = len(s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.) - 1 |
| 156 | return len(s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.) - 1 |
| 157 | } |
| 158 | |
| 159 | // Synthesized root location that will be placed at the beginning of each stack. |
| 160 | s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources. = []StackSourcescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#{{ |
| 161 | FullNamescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#FullName.: "root", |
| 162 | Displayscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Display.: []string{"root"}, |
| 163 | Placesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Places.: []StackSlotscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot#{}, |
| 164 | }} |
| 165 | |
| 166 | for _, sample := range rpt.profscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#prof..Samplescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Profile#Sample. { |
| 167 | value := rpt.optionsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#options..SampleValuescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Options#SampleValue.(sample.Valuescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Sample#Value.) |
| 168 | stack := Stackscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#{Valuescip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Value.: value, Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources.: []int{0}} // Start with the root |
| 169 | |
| 170 | // Note: we need to reverse the order in the produced stack. |
| 171 | for i := len(sample.Locationscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Sample#Location.) - 1; i >= 0; i-- { |
| 172 | loc := sample.Locationscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Sample#Location.[i] |
| 173 | for j := len(loc.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#Line.) - 1; j >= 0; j-- { |
| 174 | line := loc.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#Line.[j] |
| 175 | inlined := (j != len(loc.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Location#Line.)-1) |
| 176 | stack.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources. = append(stack.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources., getSrc(line, inlined)) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | leaf := stack.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources.[len(stack.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources.)-1] |
| 181 | s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.[leaf].Selfscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Self. += value |
| 182 | s.Stacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Stacks. = append(s.Stacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Stacks., stack) |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | func (s *StackSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#) fillPlacesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#fillPlaces().() { |
| 187 | for i, stack := range s.Stacksscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Stacks. { |
| 188 | seenSrcs := map[int]bool{} |
| 189 | for j, src := range stack.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Stack#Sources. { |
| 190 | if seenSrcs[src] { |
| 191 | continue |
| 192 | } |
| 193 | seenSrcs[src] = true |
| 194 | s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.[src].Placesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Places. = append(s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.[src].Placesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSource#Places., StackSlotscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSlot#{i, j}) |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // pickColor picks a color for key. |
| 200 | func pickColorscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/pickColor().(key string) int { |
| 201 | const numColors = 1048576 |
| 202 | h := sha256scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha256`/.Sum256scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha256`/Sum256().([]byte(key)) |
| 203 | index := binaryscip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/LittleEndian..Uint32scip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/littleEndian#Uint32().(h[:]) |
| 204 | return int(index % numColors) |
| 205 | } |
| 206 | |
| 207 | // Legend returns the list of lines to display as the legend. |
| 208 | func (s *StackSetscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#) Legendscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Legend().() []string { |
| 209 | return reportLabelsscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/reportLabels().(s.reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#report., s.reportscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#report..totalscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/Report#total., len(s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.), len(s.Sourcesscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/StackSet#Sources.), 0, 0, false) |
| 210 | } |
| 211 | |
| 212 | func addLineInfoscip-go gomod github.com/google/pprof . `github.com/google/pprof/internal/report`/addLineInfo().(str string, line profilescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#) string { |
| 213 | if line.Columnscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Column. != 0 { |
| 214 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprint().(str, ":", line.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Line., ":", line.Columnscip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Column.) |
| 215 | } |
| 216 | if line.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Line. != 0 { |
| 217 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprint().(str, ":", line.Linescip-go gomod github.com/google/pprof . `github.com/google/pprof/profile`/Line#Line.) |
| 218 | } |
| 219 | return str |
| 220 | } |