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

Function TestNodeletCountCapping

internal/graph/dotgraph_test.go:237–288  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

235}
236
237func TestNodeletCountCapping(t *testing.T) {
238 labelTags := make(TagMap)
239 for i := 0; i < 10; i++ {
240 name := fmt.Sprintf("tag-%d", i)
241 labelTags[name] = &Tag{
242 Name: name,
243 Flat: 10,
244 Cum: 10,
245 }
246 }
247 numTags := make(TagMap)
248 for i := 0; i < 10; i++ {
249 name := fmt.Sprintf("num-tag-%d", i)
250 numTags[name] = &Tag{
251 Name: name,
252 Unit: "mb",
253 Value: 16,
254 Flat: 10,
255 Cum: 10,
256 }
257 }
258 node1 := &Node{
259 Info: NodeInfo{Name: "node1-with-tags"},
260 Flat: 10,
261 Cum: 10,
262 NumericTags: map[string]TagMap{"": numTags},
263 LabelTags: labelTags,
264 }
265 node2 := &Node{
266 Info: NodeInfo{Name: "node2"},
267 Flat: 15,
268 Cum: 15,
269 }
270 node3 := &Node{
271 Info: NodeInfo{Name: "node3"},
272 Flat: 15,
273 Cum: 15,
274 }
275 g := &Graph{
276 Nodes: Nodes{
277 node1,
278 node2,
279 node3,
280 },
281 }
282 for n := 1; n <= 3; n++ {
283 input := maxNodelets + n
284 if got, want := len(g.SelectTopNodes(input, true)), n; got != want {
285 t.Errorf("SelectTopNodes(%d): got %d nodes, want %d", input, got, want)
286 }
287 }
288}
289
290func TestMultilinePrintableName(t *testing.T) {
291 ni := &NodeInfo{

Callers

nothing calls this directly

Calls 1

SelectTopNodesMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…