Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for BenchmarkContendedSemaphore (0.17 sec)

  1. src/sync/mutex_test.go

    	}
    	for i := 0; i < 10; i++ {
    		<-c
    	}
    }
    
    func BenchmarkUncontendedSemaphore(b *testing.B) {
    	s := new(uint32)
    	*s = 1
    	HammerSemaphore(s, b.N, make(chan bool, 2))
    }
    
    func BenchmarkContendedSemaphore(b *testing.B) {
    	b.StopTimer()
    	s := new(uint32)
    	*s = 1
    	c := make(chan bool)
    	defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2))
    	b.StartTimer()
    
    	go HammerSemaphore(s, b.N/2, c)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 16 21:25:35 UTC 2022
    - 5.9K bytes
    - Viewed (0)
Back to top