func NewSPSCQReaderWriter(size int64) *SPSCQReaderWriter {
	p2Size := fmath.NxtPowerOfTwo(size)
	q, err := spscq.NewPointerQ(p2Size, 1024)
	if err != nil {
		panic(err)
	}
	return &SPSCQReaderWriter{
		q: q,
	}
}
Exemple #2
0
func pqarlTest(msgCount, batchSize, qSize int64, profile bool) {
	q := spscq.NewPointerQ(qSize)
	done := make(chan bool)
	if profile {
		f, err := os.Create("prof_pqarl")
		if err != nil {
			panic(err.Error())
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}
	go pqarlDequeue(msgCount, q, batchSize, done)
	go pqarlEnqueue(msgCount, q, batchSize, done)
	<-done
	<-done
}