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

Function numLabelsToString

profile/profile.go:696–714  ·  view source on GitHub ↗

numLabelsToString returns a string representation of a map representing numeric labels.

(numLabels map[string][]int64, numUnits map[string][]string)

Source from the content-addressed store, hash-verified

694// numLabelsToString returns a string representation of a map
695// representing numeric labels.
696func numLabelsToString(numLabels map[string][]int64, numUnits map[string][]string) string {
697 ls := []string{}
698 for k, v := range numLabels {
699 units := numUnits[k]
700 var labelString string
701 if len(units) == len(v) {
702 values := make([]string, len(v))
703 for i, vv := range v {
704 values[i] = fmt.Sprintf("%d %s", vv, units[i])
705 }
706 labelString = fmt.Sprintf("%s:%v", k, values)
707 } else {
708 labelString = fmt.Sprintf("%s:%v", k, v)
709 }
710 ls = append(ls, labelString)
711 }
712 sort.Strings(ls)
713 return strings.Join(ls, " ")
714}
715
716// SetLabel sets the specified key to the specified value for all samples in the
717// profile.

Callers 1

stringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…