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

Function sampleFormat

internal/driver/driver.go:368–382  ·  view source on GitHub ↗

sampleFormat returns a function to extract values out of a profile.Sample, and the type/units of those values.

(p *profile.Profile, sampleIndex string, mean bool)

Source from the content-addressed store, hash-verified

366// sampleFormat returns a function to extract values out of a profile.Sample,
367// and the type/units of those values.
368func sampleFormat(p *profile.Profile, sampleIndex string, mean bool) (value, meanDiv sampleValueFunc, v *profile.ValueType, err error) {
369 if len(p.SampleType) == 0 {
370 return nil, nil, nil, fmt.Errorf("profile has no samples")
371 }
372 index, err := p.SampleIndexByName(sampleIndex)
373 if err != nil {
374 return nil, nil, nil, err
375 }
376 value = valueExtractor(index)
377 if mean {
378 meanDiv = valueExtractor(0)
379 }
380 v = p.SampleType[index]
381 return
382}
383
384func valueExtractor(ix int) sampleValueFunc {
385 return func(v []int64) int64 {

Callers 1

reportOptionsFunction · 0.85

Calls 2

valueExtractorFunction · 0.85
SampleIndexByNameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…