Package com.higherfrequencytrading.chronicle.impl

Examples of com.higherfrequencytrading.chronicle.impl.IntIndexedChronicle


*/
public class JETest {
    public static void main(String[] args) throws Exception {
        final String basePath = "test";
        ChronicleTools.deleteOnExit(basePath);
        final Chronicle chronicle = new IntIndexedChronicle(basePath);
        final Excerpt excerpt = chronicle.createExcerpt();
        final int[] consolidates = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
        int repeats = 10000;
        for (int i = 0; i < repeats; i++) {
            excerpt.startExcerpt(8 + 4 + 4 * consolidates.length);
            excerpt.writeLong(System.nanoTime());
            excerpt.writeInt(consolidates.length);
            for (final int consolidate : consolidates) {
                excerpt.writeInt(consolidate);
            }
            excerpt.finish();
        }

        long[] times = new long[repeats];
        int[] nbcs = new int[repeats];
        int count = 0;
        final Excerpt excerpt2 = chronicle.createExcerpt();
        while (excerpt2.nextIndex()) {
            final long timestamp = excerpt2.readLong();
            long time = System.nanoTime() - timestamp;
            times[count] = time;
            final int nbConsolidates = excerpt2.readInt();
            nbcs[count] = nbConsolidates;
            for (int i = 0; i < nbConsolidates; i++) {
                excerpt2.readInt();
            }
            excerpt2.finish();
            count++;
        }
        for (int i = 0; i < count; i++) {
            System.out.print("latency: " + times[i] / repeats / 1e3 + " us average, ");
            System.out.println("nbConsolidates: " + nbcs[i]);
        }
        chronicle.close();
    }
View Full Code Here


        if x % 1000 == 0:
          print '... row %d' % x
*/

        String basePath = baseDir + "/deleteme.int";
        Chronicle chronicle = new IntIndexedChronicle(basePath);
        deleteOnExit(basePath);

        Excerpt record = chronicle.createExcerpt();
        final int warmup = 20000;
        final int rows = 1000000;

        byte[] xs = new byte[120];
        Arrays.fill(xs, (byte) 'x');
View Full Code Here

    private final String basePath;

    public PackedHashedTable(String basePath, int hashBucketBits, int hashCapacityBits, int maxRecordSize) throws IOException {
        this.basePath = basePath;
        this.maxRecordSize = maxRecordSize;
        hash = new IntIndexedChronicle(basePath + ".hash", Math.min(24, hashCapacityBits - 4));
        hashRecord = new HashRecord(hash.createExcerpt(), hashBucketBits, hashCapacityBits);

        while (hash.size() < 1 << hashBucketBits)
            hashRecord.addEntry();

        records = new IntIndexedChronicle(basePath + ".record", Math.min(26, hashCapacityBits - 2));
        recordsExcerpt = records.createExcerpt();
    }
View Full Code Here

TOP

Related Classes of com.higherfrequencytrading.chronicle.impl.IntIndexedChronicle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.