mirror of
https://github.com/golang/go.git
synced 2026-02-06 09:50:02 +00:00
runtime/trace: add Log benchmark
This is a pretty decent benchmark of the baseline event cost. Change-Id: I22a7fa3411bd80be3bd8093d5933e29062cb1377 Reviewed-on: https://go-review.googlesource.com/c/go/+/723060 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
6aeacdff38
commit
8d9906cd34
1 changed files with 13 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ package trace_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
. "runtime/trace"
|
||||
"testing"
|
||||
)
|
||||
|
|
@ -34,3 +35,15 @@ func BenchmarkNewTask(b *testing.B) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkLog(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
|
||||
Start(io.Discard)
|
||||
defer Stop()
|
||||
|
||||
ctx := context.Background()
|
||||
for b.Loop() {
|
||||
Log(ctx, "", "")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue