MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / BenchmarkRWMutex_Lock

Function BenchmarkRWMutex_Lock

internal/utils/sync/rw_mutex_test.go:21–33  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

19}
20
21func BenchmarkRWMutex_Lock(b *testing.B) {
22 var locker = syncutils.NewRWMutex(runtime.NumCPU())
23
24 b.RunParallel(func(pb *testing.PB) {
25 var i = 0
26 for pb.Next() {
27 i++
28 locker.Lock(i)
29 time.Sleep(1 * time.Millisecond)
30 locker.Unlock(i)
31 }
32 })
33}
34
35func BenchmarkRWMutex_Lock2(b *testing.B) {
36 var locker = &sync.Mutex{}

Callers

nothing calls this directly

Calls 3

NextMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected