private void nextTimestamp() { // Next, read timestamp long deltaDelta = 0; int toRead = bitsToRead(); if (toRead > 0) { deltaDelta = in.getLong(toRead); if(toRead == 32) { if ((int) deltaDelta == 0xFFFFFFFF) { // End of stream endOfStream = true; return; } } else { // Turn "unsigned" long value back to signed one if(deltaDelta > (1 << (toRead - 1))) { deltaDelta -= (1 << toRead); } } deltaDelta = (int) deltaDelta; } storedDelta = storedDelta + deltaDelta; storedTimestamp = storedDelta + storedTimestamp; nextValue(); }
/** * Returns the next pair in the time series, if available. * * @return Pair if there's next value, null if series is done. */ public Pair readPair() { next(); if(endOfStream) { return null; } return new Pair(storedTimestamp, storedVal); }
public Decompressor(BitInput input) { in = input; readHeader(); }
@Benchmark @OperationsPerInvocation(100000) public void decodingBenchmark(DataGenerator dg, Blackhole bh) throws Exception { ByteBuffer duplicate = dg.compressedBuffer.duplicate(); ByteBufferBitInput input = new ByteBufferBitInput(duplicate); Decompressor d = new Decompressor(input); Pair pair; while((pair = d.readPair()) != null) { bh.consume(pair); } }
private void next() { if (storedTimestamp == 0) { // First item to read storedDelta = in.getLong(Compressor.FIRST_DELTA_BITS); if(storedDelta == (1<<27) - 1) { endOfStream = true; return; } storedVal = in.getLong(64); storedTimestamp = blockTimestamp + storedDelta; } else { nextTimestamp(); } }
@Benchmark @OperationsPerInvocation(100000) public void decodingBenchmark(DataGenerator dg, Blackhole bh) throws Exception { ByteBuffer duplicate = dg.compressedBuffer.duplicate(); ByteBufferBitInput input = new ByteBufferBitInput(duplicate); Decompressor d = new Decompressor(input); Pair pair; while((pair = d.readPair()) != null) { bh.consume(pair); } }
private void next() { if (storedTimestamp == 0) { // First item to read storedDelta = in.getLong(Compressor.FIRST_DELTA_BITS); if(storedDelta == (1<<27) - 1) { endOfStream = true; return; } storedVal = in.getLong(64); storedTimestamp = blockTimestamp + storedDelta; } else { nextTimestamp(); } }
Decompressor d = new Decompressor(in); Pair pair; while ((pair = d.readPair()) != null) { if (pair.getTimestamp() >= start && pair.getTimestamp() < end) { DataPoint<T> dataPoint = null;
private void nextTimestamp() { // Next, read timestamp long deltaDelta = 0; int toRead = bitsToRead(); if (toRead > 0) { deltaDelta = in.getLong(toRead); if(toRead == 32) { if ((int) deltaDelta == 0xFFFFFFFF) { // End of stream endOfStream = true; return; } } else { // Turn "unsigned" long value back to signed one if(deltaDelta > (1 << (toRead - 1))) { deltaDelta -= (1 << toRead); } } deltaDelta = (int) deltaDelta; } storedDelta = storedDelta + deltaDelta; storedTimestamp = storedDelta + storedTimestamp; nextValue(); }
/** * Returns the next pair in the time series, if available. * * @return Pair if there's next value, null if series is done. */ public Pair readPair() { next(); if(endOfStream) { return null; } return new Pair(storedTimestamp, storedVal); }
public Decompressor(BitInput input) { in = input; readHeader(); }
Decompressor d = new Decompressor(in); Pair pair; while ((pair = d.readPair()) != null) { if (pair.getTimestamp() >= start && pair.getTimestamp() < end) { DataPoint<T> dataPoint = null;