@@ -0,0 +1,2266 @@
+package net.openhft.chronicle.examples;%0A%0Aimport net.openhft.chronicle.Chronicle;%0Aimport net.openhft.chronicle.ExcerptAppender;%0Aimport net.openhft.chronicle.IndexedChronicle;%0Aimport net.openhft.chronicle.tools.ChronicleTools;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.util.concurrent.locks.LockSupport;%0A%0A/*%0ATo add a load to the system, run the following in the console if you have a fast drive.%0A%0Awhile true; do dd if=/dev/zero of=$RANDOM bs=10240 count=10000; sleep 1; done%0A */%0Apublic class PagingLatencyTest %7B%0A    private static final String TMP = System.getProperty(%22user.home%22 /*%22java.io.tmpdir%22*/);%0A    public static final int WARMUP = 10 * 1000;%0A%0A    public static void main(String%5B%5D args) throws IOException, InterruptedException %7B%0A        String path = new File(TMP, %22test-paging-latency%22).getAbsolutePath();%0A%0A        ChronicleTools.deleteOnExit(path);%0A        Chronicle chronicle = new IndexedChronicle(path);%0A%0A        long start = System.currentTimeMillis();%0A        double max = 0;%0A%0A        ExcerptAppender e = chronicle.createAppender();%0A        int ones = 0, tens = 0, hundreds = 0;%0A        for (int i = 0; i %3C 2 * 1000 * 1000; ++i) %7B%0A            long s = System.nanoTime();%0A            e.startExcerpt();%0A            e.writeLong(1);%0A            long s2 = System.nanoTime();%0A            e.position(1024 - 4); // 1K bytes total.%0A            e.finish();%0A            long s3 = System.nanoTime();%0A            double t = (s3 - s) / 100000 / 1e1;%0A            double t2 = (s2 - s) / 100000 / 1e1;%0A            double t3 = (s3 - s2) / 100000 / 1e1;%0A%0A            if (i %3E WARMUP) %7B%0A                if (t %3E max) max = t;%0A                if (t %3E 1) %7B%0A                    System.err.println(e.index() + %22 took %22 + t + %22 ms. %22 + t2 + %22 / %22 + t3);%0A                    if (t %3E= 100) hundreds++;%0A                    else if (t %3E= 10) tens++;%0A                    else if (t %3E= 1) ones++;%0A                %7D%0A            %7D%0A%0A//            while (System.nanoTime() - s3 %3C 1e5);%0A            LockSupport.parkNanos(100000); // 0.1 ms.%0A        %7D%0A        System.out.printf(%221s: %25,d 10s: %25,d 100s %25,d%25n%22, ones, tens, hundreds);%0A%0A        System.out.println(%22Finished in %22 + (System.currentTimeMillis() - start) + %22ms, max=%22 + max);%0A        chronicle.close();%0A    %7D%0A%7D%0A

Add a test for paging latency.