MCPcopy Index your code
hub / github.com/deepflowio/deepflow / BenchmarkNativePoolGetPut2Thread

Function BenchmarkNativePoolGetPut2Thread

server/libs/pool/pool_test.go:44–66  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

42}
43
44func BenchmarkNativePoolGetPut2Thread(b *testing.B) {
45 pools := make([]*sync.Pool, 16)
46 for i := range pools {
47 pool := &sync.Pool{New: func() interface{} { return 0 }}
48 pools[i] = pool
49 }
50
51 put := func(pool []*sync.Pool) {
52 for i := 0; i < b.N; i++ {
53 for _, p := range pools {
54 p.Put(0)
55 }
56 }
57 }
58
59 b.ResetTimer()
60 go put(pools)
61 for i := 0; i < b.N; i++ {
62 for _, p := range pools {
63 p.Get()
64 }
65 }
66}
67
68func BenchmarkNativePoolHungryGet(b *testing.B) {
69 pool := &sync.Pool{New: func() interface{} { return 0 }}

Callers

nothing calls this directly

Calls 2

PutMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected