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

Function benchmarkURL

internal/driver/webui_test.go:309–332  ·  view source on GitHub ↗
(b *testing.B, path string, needDot bool)

Source from the content-addressed store, hash-verified

307func BenchmarkDot(b *testing.B) { benchmarkURL(b, "/", true) }
308
309func benchmarkURL(b *testing.B, path string, needDot bool) {
310 if needDot {
311 if _, err := exec.LookPath("dot"); err != nil {
312 b.Skip("dot not available")
313 }
314 }
315 prof := largeProfile(b)
316 server := makeTestServer(b, prof)
317 url := server.URL + path
318 b.ResetTimer()
319 for i := 0; i < b.N; i++ {
320 res, err := http.Get(url)
321 if err != nil {
322 b.Fatal(err)
323 }
324 data, err := io.ReadAll(res.Body)
325 if err != nil {
326 b.Fatal(err)
327 }
328 if i == 0 && testing.Verbose() {
329 b.Logf("%-12s : %10d bytes", path, len(data))
330 }
331 }
332}

Callers 3

BenchmarkTopFunction · 0.85
BenchmarkFlameFunction · 0.85
BenchmarkDotFunction · 0.85

Calls 2

largeProfileFunction · 0.85
makeTestServerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…