diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-19 08:53:52 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-19 08:53:52 +0000 |
commit | b88e5463bcdaad35764039d8e6a22c13c50abd54 (patch) | |
tree | b988e32ea14a3dc1b4718b1fdfa47bab087ae96c /libgo/go/runtime/norace_test.go | |
parent | 6c268c751b5fe291ef58d1f766dd2f96c4382406 (diff) | |
download | gcc-b88e5463bcdaad35764039d8e6a22c13c50abd54.tar.gz |
libgo: Update to Go 1.3 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212837 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/runtime/norace_test.go')
-rw-r--r-- | libgo/go/runtime/norace_test.go | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/libgo/go/runtime/norace_test.go b/libgo/go/runtime/norace_test.go index a3d5b00860c..3b171877a6f 100644 --- a/libgo/go/runtime/norace_test.go +++ b/libgo/go/runtime/norace_test.go @@ -9,7 +9,6 @@ package runtime_test import ( "runtime" - "sync/atomic" "testing" ) @@ -31,28 +30,17 @@ func BenchmarkSyscallExcessWork(b *testing.B) { } func benchmarkSyscall(b *testing.B, work, excess int) { - const CallsPerSched = 1000 - procs := runtime.GOMAXPROCS(-1) * excess - N := int32(b.N / CallsPerSched) - c := make(chan bool, procs) - for p := 0; p < procs; p++ { - go func() { - foo := 42 - for atomic.AddInt32(&N, -1) >= 0 { - runtime.Gosched() - for g := 0; g < CallsPerSched; g++ { - runtime.Entersyscall() - for i := 0; i < work; i++ { - foo *= 2 - foo /= 2 - } - runtime.Exitsyscall() - } + b.SetParallelism(excess) + b.RunParallel(func(pb *testing.PB) { + foo := 42 + for pb.Next() { + runtime.Entersyscall() + for i := 0; i < work; i++ { + foo *= 2 + foo /= 2 } - c <- foo == 42 - }() - } - for p := 0; p < procs; p++ { - <-c - } + runtime.Exitsyscall() + } + _ = foo + }) } |