MCPcopy Index your code
hub / github.com/tinygo-org/tinygo / processBench

Method processBench

src/testing/benchmark.go:456–486  ·  view source on GitHub ↗

processBench runs bench b and prints the results.

(ctx *benchContext)

Source from the content-addressed store, hash-verified

454
455// processBench runs bench b and prints the results.
456func (b *B) processBench(ctx *benchContext) {
457 benchName := b.name
458
459 for i := 0; i < flagCount; i++ {
460 if ctx != nil {
461 fmt.Printf("%-*s\t", ctx.maxLen, benchName)
462 }
463 r := b.doBench()
464 if b.failed {
465 // The output could be very long here, but probably isn't.
466 // We print it all, regardless, because we don't want to trim the reason
467 // the benchmark failed.
468 fmt.Printf("--- FAIL: %s\n%s", benchName, "") // b.output)
469 return
470 }
471 if ctx != nil {
472 results := r.String()
473
474 if *benchmarkMemory || b.showAllocResult {
475 results += "\t" + r.MemString()
476 }
477 fmt.Println(results)
478
479 // Print any benchmark output
480 if b.output.Len() > 0 {
481 fmt.Printf("--- BENCH: %s\n", benchName)
482 b.output.WriteTo(os.Stdout)
483 }
484 }
485 }
486}
487
488// Run benchmarks f as a subbenchmark with the given name. It reports
489// true if the subbenchmark succeeded.

Callers 1

runMethod · 0.95

Calls 5

doBenchMethod · 0.95
MemStringMethod · 0.80
StringMethod · 0.65
LenMethod · 0.65
WriteToMethod · 0.45

Tested by

no test coverage detected