]> Cypherpunks repositories - gostls13.git/commit
runtime/trace: add simple benchmarks for user annotation
authorHana Kim <hakim@google.com>
Tue, 24 Apr 2018 16:42:47 +0000 (12:42 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Tue, 24 Apr 2018 17:43:19 +0000 (17:43 +0000)
commit3bf16444283094bf03a96fa76f3c5dd4c84867b2
treea47f63e867d3d91435fe509070b04cdebd03d7c7
parentc2d10243688194346f660591fe4159e30a8d20ec
runtime/trace: add simple benchmarks for user annotation

Also, avoid Region creation when tracing is disabled.
Unfortunate side-effect of this change is that we no longer trace
pre-existing regions in tracing, but we can add the feature in
the future when we find it useful and justifiable. Until then,
let's avoid the overhead from this low-level api use as much as
possible.

goos: linux
goarch: amd64
pkg: runtime/trace

// Trace disabled
BenchmarkStartRegion-12 2000000000          0.66 ns/op        0 B/op        0 allocs/op
BenchmarkNewTask-12     30000000         40.4 ns/op       56 B/op        2 allocs/op

// Trace enabled, -trace=/dev/null
BenchmarkStartRegion-12  5000000        287 ns/op       32 B/op        1 allocs/op
BenchmarkNewTask-12      5000000        283 ns/op       56 B/op        2 allocs/op

Also, skip other tests if tracing is already enabled.

Change-Id: Id3028d60b5642fcab4b09a74fd7d79361a3861e5
Reviewed-on: https://go-review.googlesource.com/109115
Reviewed-by: Peter Weinberger <pjw@google.com>
src/runtime/trace/annotation.go
src/runtime/trace/annotation_test.go
src/runtime/trace/trace_stack_test.go
src/runtime/trace/trace_test.go