mirror of
https://github.com/golang/go.git
synced 2026-01-29 07:02:05 +03: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:
committed by
Michael Knyszek
parent
6aeacdff38
commit
8d9906cd34
@@ -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, "", "")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user