Java Code Examples for org.apache.lucene.util.RamUsageEstimator#alignObjectSize()

The following examples show how to use org.apache.lucene.util.RamUsageEstimator#alignObjectSize() . 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: ContainsPrefixTreeQuery.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public long ramBytesUsed() {
  return RamUsageEstimator.alignObjectSize(
        RamUsageEstimator.NUM_BYTES_OBJECT_REF
      + Integer.BYTES)
      + intSet.ramBytesUsed();
}
 
Example 2
Source File: DirectMonotonicReader.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public long ramBytesUsed() {
  // Don't include meta, which should be accounted separately
  return BASE_RAM_BYTES_USED + RamUsageEstimator.shallowSizeOf(readers) +
      // Assume empty objects for the readers
      nonZeroBpvs * RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER);
}
 
Example 3
Source File: AbstractPagedMutable.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public long ramBytesUsed() {
  long bytesUsed = RamUsageEstimator.alignObjectSize(baseRamBytesUsed());
  bytesUsed += RamUsageEstimator.alignObjectSize(RamUsageEstimator.shallowSizeOf(subMutables));
  for (PackedInts.Mutable gw : subMutables) {
    bytesUsed += gw.ramBytesUsed();
  }
  return bytesUsed;
}
 
Example 4
Source File: GrowableWriter.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public long ramBytesUsed() {
  return RamUsageEstimator.alignObjectSize(
      RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
      + RamUsageEstimator.NUM_BYTES_OBJECT_REF
      + Long.BYTES
      + Float.BYTES)
      + current.ramBytesUsed();
}
 
Example 5
Source File: Packed64.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public long ramBytesUsed() {
  return RamUsageEstimator.alignObjectSize(
      RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
      + 3 * Integer.BYTES   // bpvMinusBlockSize,valueCount,bitsPerValue
      + Long.BYTES          // maskRight
      + RamUsageEstimator.NUM_BYTES_OBJECT_REF) // blocks ref
      + RamUsageEstimator.sizeOf(blocks);
}
 
Example 6
Source File: Packed64SingleBlock.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public long ramBytesUsed() {
  return RamUsageEstimator.alignObjectSize(
      RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
      + 2 * Integer.BYTES     // valueCount,bitsPerValue
      + RamUsageEstimator.NUM_BYTES_OBJECT_REF) // blocks ref
      + RamUsageEstimator.sizeOf(blocks);
}
 
Example 7
Source File: OperationContextLogSizeEstimator.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public long estimateSize(@Nullable OperationContextLog value) {
    long size = 0L;

    // OperationContextLog
    size += 32L; // 24 bytes (ref+headers) + 8 bytes (ended)
    size += value.errorMessage() == null ? 0 : value.errorMessage().length();  // error message

    // OperationContext
    size += 60L; // 24 bytes (headers) + 4 bytes (id) + 16 bytes (uuid) + 8 bytes (started) + 8 bytes (usedBytes)
    size += value.name().length();

    return RamUsageEstimator.alignObjectSize(size);
}
 
Example 8
Source File: JobContextLogSizeEstimator.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public long estimateSize(@Nullable JobContextLog value) {
    long size = 0L;

    // JobContextLog
    size += 32L; // 24 bytes (ref+headers) + 8 bytes (ended)
    size += value.errorMessage() == null ? 0 : value.errorMessage().length();

    // JobContext
    size += 52L; // 24 bytes (ref+headers) + 4 bytes (id) + 8 bytes (started) + 16 bytes (uuid)
    size += value.statement().length();

    return RamUsageEstimator.alignObjectSize(size);
}
 
Example 9
Source File: BigArrays.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return SHALLOW_SIZE + RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + RamUsageEstimator.NUM_BYTES_OBJECT_REF * size());
}
 
Example 10
Source File: Term.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
  return BASE_RAM_BYTES +
      RamUsageEstimator.sizeOfObject(field) +
      (bytes != null ? RamUsageEstimator.alignObjectSize(bytes.bytes.length + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER) : 0L);
}
 
Example 11
Source File: PackedInts.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
  return RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + Integer.BYTES);
}
 
Example 12
Source File: BigArrays.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public long ramBytesUsed() {
    return SHALLOW_SIZE + RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER +
        RamUsageEstimator.NUM_BYTES_OBJECT_REF * size());
}
 
Example 13
Source File: StringSizeEstimator.java    From crate with Apache License 2.0 4 votes vote down vote up
public static long estimateSize(@Nullable BytesRef value) {
    if (value == null) {
        return 8;
    }
    return RamUsageEstimator.alignObjectSize(BASE_BYTES_PER_BYTES_REF + value.length);
}