public long readLong(int offset) { return excerpt.readLong(offset); }
public long readLong() { return excerpt.readLong(); }
@Override public boolean onExcerpt(@NotNull Excerpt recordExcerpt) { found[0] |= recordExcerpt.readLong() == 1234567890L; return false; } });
@Nullable @Override public Date parse(@NotNull Excerpt excerpt, @NotNull StopCharTester tester) { return lookupDate(excerpt.readLong()); } }
public boolean readEntry() { if (!excerpt.nextIndex()) return false; long writeTimeMS = excerpt.readLong(); long writeTimeNS = excerpt.readLong(); int pos = excerpt.position(); long readTimeNS = excerpt.readLong(); if (targetReader && readTimeNS == 0) excerpt.writeLong(pos, readTimeNS = System.nanoTime()); int length = excerpt.readInt24(); char type = (char) excerpt.readUnsignedByte(); onEntry(writeTimeMS, writeTimeNS, readTimeNS, length, type, excerpt); return true; }
public void readFromGateway(@NotNull Excerpt in) { excerptId = in.index(); writeTimestampMillis = in.readLong(); inWriteTimestamp7 = in.readLong(); inReadTimestamp7Delta = in.readUnsignedInt(); if (inReadTimestamp7Delta == 0 && targetReader) in.writeUnsignedInt(in.position() - 4, inReadTimestamp7Delta = fastTime() - inWriteTimestamp7); }
@Override public void readMarshallable(@NotNull Excerpt in) throws IllegalStateException { startMS = in.readLong(); count = (int) in.readStopBit(); for (int i = 0; i < count; i++) timings[i] = in.readLong(); if (readStage != null && timings[readStage.ordinal()] == 0) { long now = setTimeStamp(readStage); in.writeLong(in.position() - 8, now); } }
public void readFromEngine(@NotNull Excerpt in, int sourceId) { this.sourceId = in.readInt(); excerptId = in.readLong(); targetReader = sourceId == this.sourceId; writeTimestampMillis = in.readLong(); inWriteTimestamp7 = in.readLong(); inReadTimestamp7Delta = in.readUnsignedInt(); outWriteTimestamp7Delta = in.readUnsignedInt(); outReadTimestamp7Delta = in.readUnsignedInt(); if (outReadTimestamp7Delta == 0 && targetReader) in.writeUnsignedInt(in.position() - 4, outReadTimestamp7Delta = fastTime() - inWriteTimestamp7); } }
final Excerpt excerpt2 = chronicle.createExcerpt(); while (excerpt2.nextIndex()) { final long timestamp = excerpt2.readLong(); long time = System.nanoTime() - timestamp; times[count] = time;
@Override public void run() { try { final IndexedChronicle tsc = new IndexedChronicle(basePath); tsc.useUnsafe(USE_UNSAFE); final IndexedChronicle tsc2 = new IndexedChronicle(basePath2); tsc2.useUnsafe(USE_UNSAFE); tsc2.clear(); Excerpt excerpt = tsc.createExcerpt(); Excerpt excerpt2 = tsc2.createExcerpt(); for (int i = 0; i < RUNS; i++) { do { /* try again */ } while (!excerpt.index(i)); long time = excerpt.readLong(); excerpt.finish(); excerpt2.startExcerpt(8); excerpt2.writeLong(time); excerpt2.finish(); } } catch (IOException e) { e.printStackTrace(); } } });
assertEquals(i, n); excerpt.readChars(sb); excerpt.readLong(); excerpt.readDouble(); excerpt.finish();
long time0 = excerpt2.readLong(); excerpt2.finish(); if (i >= WARMUP) {
@Override public void run() { al2.bind(); try { final IndexedChronicle tsc = new IndexedChronicle(basePath); tsc.useUnsafe(USE_UNSAFE); final IndexedChronicle tsc2 = new IndexedChronicle(basePath2); tsc2.useUnsafe(USE_UNSAFE); tsc2.clear(); Excerpt excerpt = tsc.createExcerpt(); Excerpt excerpt2 = tsc2.createExcerpt(); for (int i = 0; i < RUNS; i++) { do { busyWait(); } while (!excerpt.index(i)); long time = excerpt.readLong(); excerpt.finish(); excerpt2.startExcerpt(8); excerpt2.writeLong(time); excerpt2.finish(); } } catch (IOException e) { e.printStackTrace(); } finally { al2.release(); } } });
long time0 = excerpt2.readLong(); excerpt2.finish(); if (i >= WARMUP) {
public long readLong(int offset) { return excerpt.readLong(offset); }
public long readLong() { return excerpt.readLong(); }
@Nullable @Override public Date parse(@NotNull Excerpt excerpt, @NotNull StopCharTester tester) { return lookupDate(excerpt.readLong()); } }
public boolean readEntry() { if (!excerpt.nextIndex()) return false; long writeTimeMS = excerpt.readLong(); long writeTimeNS = excerpt.readLong(); int pos = excerpt.position(); long readTimeNS = excerpt.readLong(); if (targetReader && readTimeNS == 0) excerpt.writeLong(pos, readTimeNS = System.nanoTime()); int length = excerpt.readInt24(); char type = (char) excerpt.readUnsignedByte(); onEntry(writeTimeMS, writeTimeNS, readTimeNS, length, type, excerpt); return true; }
// create a Chronicle for reading or writing. String basePath = TMP + File.separator + "deleteme.ict"; IndexedChronicle tsc = new IndexedChronicle(basePath); // create a handle to excerpts in the chronicle. Excerpt excerpt = tsc.createExcerpt(); // add 1024 entries. int counter = 1; 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(); } // somewhere else read the file int counter2 = 1; Excerpt excerpt2 = tsc.createExcerpt(); while (excerpt2.nextIndex()) { for (int j = 0; j < 128; j += 8) { long actual = excerpt2.readLong(); long expected = counter2++; if (expected != actual) assertEquals(expected, actual); } assertEquals(-1, excerpt2.readByte()); excerpt2.finish(); } assertEquals(counter, counter2);