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

Method comparePrintableName

internal/graph/graph.go:200–212  ·  view source on GitHub ↗

comparePrintableName compares NodeInfo lexicographically the same way as `i.PrintableName() < right.PrintableName()`, but much more performant.

(right NodeInfo)

Source from the content-addressed store, hash-verified

198
199// comparePrintableName compares NodeInfo lexicographically the same way as `i.PrintableName() < right.PrintableName()`, but much more performant.
200func (i *NodeInfo) comparePrintableName(right NodeInfo) (equal bool, less bool) {
201 if right == *i {
202 return true, false
203 }
204
205 if i.Address != 0 && right.Address != 0 && i.Address != right.Address {
206 // comparing ints directly is the same as comparing padded hex from fmt.Sprintf("%016x", Address)
207 return false, i.Address < right.Address
208 }
209
210 // fallback
211 return false, i.PrintableName() < right.PrintableName()
212}
213
214// NodeMap maps from a node info struct to a node. It is used to merge
215// report entries with the same info.

Callers 1

SortMethod · 0.80

Calls 1

PrintableNameMethod · 0.95

Tested by

no test coverage detected