-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconcurrentRingBuffer_test.go
51 lines (38 loc) · 1.24 KB
/
concurrentRingBuffer_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package blockingQueues
import (
. "gopkg.in/check.v1"
)
type ConcurrentRingBufferSuite struct {
queue *ConcurrentRingBuffer
}
var _ = Suite(&ConcurrentRingBufferSuite{})
func (s *ConcurrentRingBufferSuite) SetUpTest(c *C) {
s.queue = NewConcurrentRingBuffer(4096)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer1to1(c *C) {
benchmarkPut(c, 1, 1, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer2to2(c *C) {
benchmarkPut(c, 2, 2, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer4to4(c *C) {
benchmarkPut(c, 4, 4, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer4to1(c *C) {
benchmarkPutMoreWriters(c, 4, 1, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer2to1(c *C) {
benchmarkPutMoreWriters(c, 2, 1, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer3to2(c *C) {
benchmarkPutMoreWriters(c, 3, 2, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer2to3(c *C) {
benchmarkPutMoreReaders(c, 2, 3, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer1to3(c *C) {
benchmarkPutMoreReaders(c, 1, 3, s.queue)
}
func (s *ConcurrentRingBufferSuite) BenchmarkRingBuffer1to4(c *C) {
benchmarkPutMoreReaders(c, 1, 4, s.queue)
}