public int position() { return excerpt.position(); }
@NotNull public Excerpt position(int position) { return excerpt.position(position); }
/** * Take a text copy of the contents of the Excerpt without changing it's position. Can be called in the debugger. * * @param excerpt to get text from * @return 256 bytes as text with `.` replacing special bytes. */ @NotNull public static String asString(@NotNull Excerpt excerpt) { return asString(excerpt, excerpt.position()); }
void addEntry() { excerpt.startExcerpt(sizeORecordBytes); excerpt.position(sizeORecordBytes); excerpt.finish(); }
public boolean readOne() { if (!excerpt.nextIndex()) return false; int pos = excerpt.position(); MessageType mt = excerpt.readEnum(MessageType.class); if (mt == null) { // rewind and read again. excerpt.position(pos); System.err.println("Unknown message type " + excerpt.readUTF()); return true; } switch (mt) { case report: { metaData.readFromEngine(excerpt, sourceId); report.readMarshallable(excerpt); gwEvents.report(metaData, report); break; } default: System.err.println("Unknown message type " + mt); break; } return true; } }
public boolean readOne() { if (!excerpt.nextIndex()) return false; int pos = excerpt.position(); MessageType mt = excerpt.readEnum(MessageType.class); if (mt == null) { // rewind and read again. excerpt.position(pos); System.err.println("Unknown message type " + excerpt.readUTF()); return true; } switch (mt) { case small: { metaData.sourceId = sourceId; metaData.readFromGateway(excerpt); smallCommand.readMarshallable(excerpt); peEvents.small(metaData, smallCommand); break; } default: System.err.println("Unknown message type " + mt); break; } return true; } }
@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); } }
private void performAndWritePutAll(@NotNull Map<? extends K, ? extends V> m) { Excerpt excerpt = getExcerpt(m.size() * maxMessageSize, putAll); long eventId = excerpt.index(); int pos = excerpt.position(); excerpt.writeInt(0); // place holder for the actual size. int count = 0;
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); }
public void lookup(int hashCode, @NotNull Excerpt recordsExcerpt, @NotNull HashRecordIterator iterator) { int bucket = bucket(hashCode); excerpt.index(bucket); for (int i = 0, size = size(); i < size; i++) { excerpt.position(i * PER_ENTRY_SIZE + HEADER_SIZE); int hashCode2 = excerpt.readInt(); if (hashCode != hashCode2) continue; int record = excerpt.readInt(); recordsExcerpt.index(record); if (iterator.onExcerpt(recordsExcerpt)) break; } } }
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 addRecord(int hashCode, int index) { int bucket = bucket(hashCode); excerpt.index(bucket); int size = size(); excerpt.position(size * PER_ENTRY_SIZE + HEADER_SIZE); excerpt.writeInt(hashCode); excerpt.writeInt(index); excerpt.writeInt(0, size + 1); }
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); } }
/** * Take a text copy of the contents of the Excerpt without changing it's position. Can be called in the debugger. * * @param excerpt to get text from * @return 256 bytes as text with `.` replacing special bytes. */ @NotNull public static String asString(@NotNull Excerpt excerpt) { return asString(excerpt, excerpt.position()); }
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; }