Ejemplo n.º 1
0
func llqEnqueue(num int64, q *spscq.LLChunkQ, done chan bool) {
	runtime.LockOSThread()
	for i := int64(0); i < num; i++ {
		writeBuffer := q.WriteBuffer()
		for writeBuffer == nil {
			writeBuffer = q.WriteBuffer()
		}
		writeBuffer[0] = byte(i)
		q.CommitWrite()
	}
	done <- true
}
Ejemplo n.º 2
0
func llqDequeue(msgCount int64, q *spscq.LLChunkQ, done chan bool) {
	runtime.LockOSThread()
	start := time.Now().UnixNano()
	sum := int64(0)
	checksum := int64(0)
	for i := int64(0); i < msgCount; i++ {
		readBuffer := q.ReadBuffer()
		for readBuffer == nil {
			readBuffer = q.ReadBuffer()
		}
		sum += int64(readBuffer[0])
		checksum += int64(byte(i))
		q.CommitRead()
	}
	nanos := time.Now().UnixNano() - start
	printTimings(msgCount, nanos, "llq")
	expect(sum, checksum)
	done <- true
}