func benchmarkStats(b *testing.B, r render.Renderer) { report, err := loadReport() if err != nil { b.Fatal(err) } b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { // No way to tell if this was successful :( benchmarkStatsResult = r.Stats(report) } }
func decorateWithStats(rpt report.Report, renderer render.Renderer) topologyStats { var ( nodes int realNodes int edges int ) for _, n := range renderer.Render(rpt) { nodes++ if !n.Pseudo { realNodes++ } edges += len(n.Adjacency) } renderStats := renderer.Stats(rpt) return topologyStats{ NodeCount: nodes, NonpseudoNodeCount: realNodes, EdgeCount: edges, FilteredNodes: renderStats.FilteredNodes, } }