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

Method SetNumLabel

profile/profile.go:746–759  ·  view source on GitHub ↗

SetNumLabel sets the specified key to the specified value for all samples in the profile. "unit" is a slice that describes the units that each corresponding member of "values" is measured in (e.g. bytes or seconds). If there is no relevant unit for a given value, that member of "unit" should be the

(key string, value []int64, unit []string)

Source from the content-addressed store, hash-verified

744// unit for a given value, that member of "unit" should be the empty string.
745// "unit" must either have the same length as "value", or be nil.
746func (p *Profile) SetNumLabel(key string, value []int64, unit []string) {
747 for _, sample := range p.Sample {
748 if sample.NumLabel == nil {
749 sample.NumLabel = map[string][]int64{key: value}
750 } else {
751 sample.NumLabel[key] = value
752 }
753 if sample.NumUnit == nil {
754 sample.NumUnit = map[string][]string{key: unit}
755 } else {
756 sample.NumUnit[key] = unit
757 }
758 }
759}
760
761// RemoveNumLabel removes all numerical labels associated with the specified key for all
762// samples in the profile.

Callers 1

TestSetNumLabelFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestSetNumLabelFunction · 0.64