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

Function printCurrentOptions

internal/driver/interactive.go:181–219  ·  view source on GitHub ↗
(p *profile.Profile, ui plugin.UI)

Source from the content-addressed store, hash-verified

179}
180
181func printCurrentOptions(p *profile.Profile, ui plugin.UI) {
182 var args []string
183 current := currentConfig()
184 for _, f := range configFields {
185 n := f.name
186 v := current.get(f)
187 comment := ""
188 switch {
189 case len(f.choices) > 0:
190 values := append([]string{}, f.choices...)
191 sort.Strings(values)
192 comment = "[" + strings.Join(values, " | ") + "]"
193 case n == "sample_index":
194 st := sampleTypes(p)
195 if v == "" {
196 // Apply default (last sample index).
197 v = st[len(st)-1]
198 }
199 // Add comments for all sample types in profile.
200 comment = "[" + strings.Join(st, " | ") + "]"
201 case n == "source_path":
202 continue
203 case n == "nodecount" && v == "-1":
204 comment = "default"
205 case v == "":
206 // Add quotes for empty values.
207 v = `""`
208 }
209 if n == "granularity" && v == "" {
210 v = "(default)"
211 }
212 if comment != "" {
213 comment = commentStart + " " + comment
214 }
215 args = append(args, fmt.Sprintf(" %-25s = %-20s %s", n, v, comment))
216 }
217 sort.Strings(args)
218 ui.Print(strings.Join(args, "\n"))
219}
220
221// parseCommandLine parses a command and returns the pprof command to
222// execute and the configuration to use for the report.

Callers 1

interactiveFunction · 0.85

Calls 4

currentConfigFunction · 0.85
sampleTypesFunction · 0.70
PrintMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…