Skip to content

Commit 8d9906c

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 6aeacdf commit 8d9906c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/runtime/trace/annotation_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package trace_test
66

77
import (
88
"context"
9+
"io"
910
. "runtime/trace"
1011
"testing"
1112
)
@@ -34,3 +35,15 @@ func BenchmarkNewTask(b *testing.B) {
3435
}
3536
})
3637
}
38+
39+
func BenchmarkLog(b *testing.B) {
40+
b.ReportAllocs()
41+
42+
Start(io.Discard)
43+
defer Stop()
44+
45+
ctx := context.Background()
46+
for b.Loop() {
47+
Log(ctx, "", "")
48+
}
49+
}

0 commit comments

Comments
 (0)