aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/chan_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/chan_test.go')
-rw-r--r--src/pkg/runtime/chan_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pkg/runtime/chan_test.go b/src/pkg/runtime/chan_test.go
index c5ffe93acc..71c9e2fd78 100644
--- a/src/pkg/runtime/chan_test.go
+++ b/src/pkg/runtime/chan_test.go
@@ -265,3 +265,25 @@ func BenchmarkChanProdConsWork10(b *testing.B) {
func BenchmarkChanProdConsWork100(b *testing.B) {
benchmarkChanProdCons(b, 100, 100)
}
+
+func BenchmarkChanCreation(b *testing.B) {
+ const CallsPerSched = 1000
+ procs := runtime.GOMAXPROCS(-1)
+ N := int32(b.N / CallsPerSched)
+ c := make(chan bool, procs)
+ for p := 0; p < procs; p++ {
+ go func() {
+ for atomic.AddInt32(&N, -1) >= 0 {
+ for g := 0; g < CallsPerSched; g++ {
+ myc := make(chan int, 1)
+ myc <- 0
+ <-myc
+ }
+ }
+ c <- true
+ }()
+ }
+ for p := 0; p < procs; p++ {
+ <-c
+ }
+}