Exemple #1
0
func NewPointerQ(size int64) *PointerQ {
	if !powerOfTwo(size) {
		panic(fmt.Sprintf("Size must be a power of two, size = %d", size))
	}
	ringBuffer := padded.PointerSlice(int(size))
	q := &PointerQ{ringBuffer: ringBuffer, size: size, mask: size - 1}
	return q
}
Exemple #2
0
func extqTest(msgCount, batchSize, qSize int64) {
	q := spscq.NewExtQ(qSize)
	done := make(chan bool)
	f, err := os.Create("extq.prof")
	if err != nil {
		panic(err.Error())
	}
	ringBuffer = padded.PointerSlice(int(qSize))
	mask = qSize - 1
	pprof.StartCPUProfile(f)
	go extqDequeue(msgCount, q, batchSize, done)
	go extqEnqueue(msgCount, q, batchSize, done)
	<-done
	<-done
	pprof.StopCPUProfile()
}
Exemple #3
0
func NewPointerQ(size int64) *PointerQ {
	ringBuffer := padded.PointerSlice(int(size))
	q := &PointerQ{ringBuffer: ringBuffer, commonQ: newCommonQ(size)}
	return q
}