@@ -0,0 +1,2663 @@
+package net.openhft.chronicle.queue.bench;%0A%0Aimport net.openhft.chronicle.bytes.Bytes;%0Aimport net.openhft.chronicle.bytes.NativeBytesStore;%0Aimport net.openhft.chronicle.core.OS;%0Aimport net.openhft.chronicle.core.io.IOTools;%0Aimport net.openhft.chronicle.queue.ChronicleQueue;%0Aimport net.openhft.chronicle.queue.ExcerptAppender;%0Aimport net.openhft.chronicle.queue.ExcerptTailer;%0Aimport net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;%0Aimport net.openhft.chronicle.wire.DocumentContext;%0A%0Apublic class ThroughputPerfMain %7B%0A    static final int time = Integer.getInteger(%22time%22, 10);%0A    static final int size = Integer.getInteger(%22size%22, 64);%0A    static final String path = System.getProperty(%22path%22, OS.TMP);%0A%0A    public static void main(String%5B%5D args) %7B%0A        String base = path + %22/delete-%22 + System.nanoTime() + %22.me%22;%0A        long start = System.nanoTime();%0A        long count = 0;%0A        NativeBytesStore nbs = NativeBytesStore.nativeStoreWithFixedCapacity(size);%0A%0A        try (ChronicleQueue q = SingleChronicleQueueBuilder.binary(base).blockSize(512 %3C%3C 20).build()) %7B%0A            ExcerptAppender appender = q.acquireAppender();%0A            do %7B%0A                int batch = Math.max(1, (128 %3C%3C 10) / size);%0A                for (int i = 0; i %3C batch; i++) %7B%0A                    try (DocumentContext dc = appender.writingDocument()) %7B%0A                        dc.wire().bytes().write(nbs);%0A                    %7D%0A                %7D%0A                count += batch;%0A            %7D while (start + time * 1e9 %3E System.nanoTime());%0A        %7D%0A        nbs.release();%0A        long mid = System.nanoTime();%0A        long time1 = mid - start;%0A%0A        Bytes bytes = Bytes.allocateElasticDirect(64);%0A        try (ChronicleQueue q = SingleChronicleQueueBuilder.binary(base).blockSize(1 %3C%3C 30).build()) %7B%0A            ExcerptTailer tailer = q.createTailer();%0A            for (long i = 0; i %3C count; i++) %7B%0A                try (DocumentContext dc = tailer.readingDocument()) %7B%0A                    bytes.clear();%0A                    bytes.write(dc.wire().bytes());%0A                %7D%0A            %7D%0A        %7D%0A        bytes.release();%0A        long end = System.nanoTime();%0A        long time2 = end - mid;%0A%0A        System.out.printf(%22Writing %25,d messages took %25.3f seconds, at a rate of %25,d per second%25n%22,%0A                count, time1 / 1e9, (long) (1e9 * count / time1));%0A        System.out.printf(%22Reading %25,d messages took %25.3f seconds, at a rate of %25,d per second%25n%22,%0A                count, time2 / 1e9, (long) (1e9 * count / time2));%0A%0A        System.gc(); // make sure its cleaned up for windows to delete.%0A        IOTools.deleteDirWithFiles(base, 2);%0A    %7D%0A%7D%0A

Add a Throughput benchmark