Java Code Examples for org.apache.lucene.util.RamUsageEstimator#NUM_BYTES_INT

The following examples show how to use org.apache.lucene.util.RamUsageEstimator#NUM_BYTES_INT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Translog.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
    final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
    try {
        outStream.writeInt(toWrite.size());
        final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
        for (Operation op : toWrite) {
            out.reset();
            final long start = out.position();
            out.skip(RamUsageEstimator.NUM_BYTES_INT);
            writeOperationNoSize(checksumStreamOutput, op);
            long end = out.position();
            int operationSize = (int) (out.position() - RamUsageEstimator.NUM_BYTES_INT - start);
            out.seek(start);
            out.writeInt(operationSize);
            out.seek(end);
            ReleasablePagedBytesReference bytes = out.bytes();
            bytes.writeTo(outStream);
        }
    } finally {
        Releasables.close(out.bytes());
    }

}
 
Example 2
Source File: GeoPointArrayAtomicFieldData.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return RamUsageEstimator.NUM_BYTES_INT + indexedPoints.ramBytesUsed();
}
 
Example 3
Source File: GeoPointArrayAtomicFieldData.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return RamUsageEstimator.NUM_BYTES_INT + indexedPoint.ramBytesUsed()
            + (set == null ? 0 : set.ramBytesUsed());
}
 
Example 4
Source File: GeoPointArrayLegacyAtomicFieldData.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return RamUsageEstimator.NUM_BYTES_INT/*size*/ + lon.ramBytesUsed() + lat.ramBytesUsed();
}
 
Example 5
Source File: GeoPointArrayLegacyAtomicFieldData.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return RamUsageEstimator.NUM_BYTES_INT + lon.ramBytesUsed() + lat.ramBytesUsed() + (set == null ? 0 : set.ramBytesUsed());
}
 
Example 6
Source File: TranslogWriter.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
private static int getHeaderLength(int uuidLength) {
    return CodecUtil.headerLength(TRANSLOG_CODEC) + uuidLength  + RamUsageEstimator.NUM_BYTES_INT;
}
 
Example 7
Source File: Translog.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 2 * RamUsageEstimator.NUM_BYTES_LONG + RamUsageEstimator.NUM_BYTES_INT;
}
 
Example 8
Source File: BigObjectArray.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected int numBytesPerElement() {
    return RamUsageEstimator.NUM_BYTES_INT;
}
 
Example 9
Source File: BigIntArray.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected int numBytesPerElement() {
    return RamUsageEstimator.NUM_BYTES_INT;
}
 
Example 10
Source File: BigDoubleArray.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected int numBytesPerElement() {
    return RamUsageEstimator.NUM_BYTES_INT;
}
 
Example 11
Source File: LindenFieldCacheImpl.java    From linden with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
  //todo
  return RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_INT;
}