Package com.higherfrequencytrading.chronicle

Examples of com.higherfrequencytrading.chronicle.Excerpt.finish()


        List<Integer> ints = new ArrayList<Integer>();
        for (int i = 0; i < 1000; i += 10) {
            appender.startExcerpt(8);
            appender.writeInt(0xCAFEBABE);
            appender.writeInt(i);
            appender.finish();
            ints.add(i);
        }
        Excerpt excerpt = chronicle.createExcerpt();
        final MyExcerptComparator mec = new MyExcerptComparator();
        // exact matches at a the start
View Full Code Here


                        for (int k = 0; k < batchSize; k++) {
                            excerpt.writeUnsignedByte('M'); // message type
                            excerpt.writeLong(i); // e.g. time stamp
                            excerpt.writeFloat(i);
                        }
                        excerpt.finish();
                    }
                    ic.close();
                } catch (IOException e) {
                    throw new AssertionError(e);
                }
View Full Code Here

                    float d = excerpt.readFloat();
                    assert ch == 'M';
                    assert l == i;
                    assert d == (float) i;
                }
                excerpt.finish();
            }
            if (((j + blocks) % 100000000) == 0) {
                long time = System.nanoTime() - start;
                System.out.printf("... Took %.2f to write and read %,d entries%n", time / 1e9, j + blocks);
            }
View Full Code Here

        appendNum(excerpt, 54, 2);
        appendNum(excerpt, 27, 250000);
        appendNum(excerpt, 44, 7900.000000, 6);
        appendText(excerpt, 25, IOIQltyInd.H);
        appendNum(excerpt, 10, 231);
        excerpt.finish();

        assertTrue(excerpt.index(0));
        assertText(excerpt, 8, "FIX.4.1");
        assertNum(excerpt, 9, 154);
        assertNum(excerpt, 35, 6);
View Full Code Here

        final Excerpt excerpt = chr.createExcerpt();

        for (int i = 0; i < NUMBER_OF_ENTRIES; ++i) {
            excerpt.startExcerpt(128);
            excerpt.writeBytes("test");
            excerpt.finish();
        }

        assertEquals("Chronicle should hold all values", NUMBER_OF_ENTRIES, excerpt.size());

        return chr;
View Full Code Here

                        excerpt.writeLong(System.nanoTime());
                        excerpt.writeUnsignedShort(consolidates.length);
                        for (final int consolidate : consolidates) {
                            excerpt.writeStopBit(consolidate);
                        }
                        excerpt.finish();
                    }
                    chronicle.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
View Full Code Here

            final int nbConsolidates = excerpt.readUnsignedShort();
            assert nbConsolidates == consolidates.length;
            for (int i = 0; i < nbConsolidates; i++) {
                excerpt.readStopBit();
            }
            excerpt.finish();
        }
        Arrays.sort(times);
        for (double perc : new double[]{50, 90, 99, 99.9, 99.99}) {
            System.out.printf("%s%% took %.2f µs, ", perc, times[((int) (repeats * perc / 100))] / 1000.0);
        }
View Full Code Here

                    for (int i = 1; i <= messages; i++) {
                        // use a size which will cause mis-alignment.
                        excerpt.startExcerpt(9);
                        excerpt.writeLong(i);
                        excerpt.writeByte(i);
                        excerpt.finish();
//                        Thread.sleep(1);
                    }
                    System.out.println(System.currentTimeMillis() + ": Finished writing messages");
                } catch (Exception e) {
                    throw new AssertionError(e);
View Full Code Here

        for (int i = 1; i <= messages; i++) {
            while (!excerpt.nextIndex())
                count++;
            long n = excerpt.readLong();
            assertEquals(i, n);
            excerpt.finish();
        }
        sink.close();
        System.out.println("There were " + count + " misses");
        t.join();
        source.close();
View Full Code Here

        for (int i = 0; i < 1024; i++) {
            excerpt.startExcerpt(129);
            for (int j = 0; j < 128; j += 8)
                excerpt.writeLong(counter++);
            excerpt.write(-1);
            excerpt.finish();
        }

        counter = 1;
        for (int i = 0; i < 1024; i++) {
            assertTrue(excerpt.index(i));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.