• Hana Kim's avatar
    runtime/trace: add simple benchmarks for user annotation · 3bf16444
    Hana Kim authored
    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/109115Reviewed-by: 's avatarPeter Weinberger <pjw@google.com>
    3bf16444
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...