// Path: benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/ipc/Configuration.java
// public static final int MAX_THREAD_COUNT = 4;
// 
// Path: benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/ipc/Configuration.java
// public static final int RESPONSE_QUEUE_CAPACITY = 128;


import org.agrona.concurrent.ManyToOneConcurrentLinkedQueue;
import org.agrona.concurrent.OneToOneConcurrentArrayQueue;
import org.agrona.hints.ThreadHints;
import org.openjdk.jmh.annotations.*;
import java.util.Arrays;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import static uk.co.real_logic.benchmarks.aeron.ipc.Configuration.MAX_THREAD_COUNT;
import static uk.co.real_logic.benchmarks.aeron.ipc.Configuration.RESPONSE_QUEUE_CAPACITY;

        Thread consumerThread;

        @Setup
        public synchronized void setup()
        {
            for (int i = 0; i < MAX_THREAD_COUNT; i++)
            {
                responseQueues[i] = new OneToOneConcurrentArrayQueue<>(RESPONSE_QUEUE_CAPACITY);
            }

            values = new Integer[burstLength];
            for (int i = 0; i < burstLength; i++)
            {
                values[i] = -(burstLength - i);
            }

            consumerThread = new Thread(
                () ->
                {
                    while (true)
                    {
                        final Integer value = sendQueue.poll();
                        if (null == value)
                        {
                            if (!running.get())
                            {
                                break;
                            }

// Path: benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/ipc/Configuration.java
// public static final int MAX_THREAD_COUNT = 4;
// 
// Path: benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/ipc/Configuration.java
// public static final int RESPONSE_QUEUE_CAPACITY = 128;


// Path: benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/ipc/ManyToOneConcurrentLinkedQueueBenchmark.java
import org.agrona.concurrent.ManyToOneConcurrentLinkedQueue;
import org.agrona.concurrent.OneToOneConcurrentArrayQueue;
import org.agrona.hints.ThreadHints;
import org.openjdk.jmh.annotations.*;
import java.util.Arrays;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import static uk.co.real_logic.benchmarks.aeron.ipc.Configuration.MAX_THREAD_COUNT;
import static uk.co.real_logic.benchmarks.aeron.ipc.Configuration.RESPONSE_QUEUE_CAPACITY;


        Thread consumerThread;

        @Setup
        public synchronized void setup()
        {
            for (int i = 0; i < MAX_THREAD_COUNT; i++)
            {
                responseQueues[i] = new OneToOneConcurrentArrayQueue<>(RESPONSE_QUEUE_CAPACITY);
            }

            values = new Integer[burstLength];
            for (int i = 0; i < burstLength; i++)
            {
                values[i] = -(burstLength - i);
            }

            consumerThread = new Thread(
                () ->
                {
                    while (true)
                    {
                        final Integer value = sendQueue.poll();
                        if (null == value)
                        {
                            if (!running.get())
                            {
                                break;
                            }

                            ThreadHints.onSpinWait();