Java 类io.netty.buffer.UnsafeDirectLittleEndian 实例源码

项目:dremio-oss    文件:BatchStats.java   
public long getSize(ValueVector v, SizeType type){
  long size = 0;
  ArrowBuf[] buffers = v.getBuffers(false);
  for(ArrowBuf b : buffers){
    switch(type){
    case ACCOUNTED:
      size += b.getActualMemoryConsumed();
      break;
    case WORSE_CASE:
      UnsafeDirectLittleEndian udle = (UnsafeDirectLittleEndian) b.unwrap();
      // avoid counting the same underlying buffer multiple times
      if (accountedBuffers.containsKey(udle)) {
        continue;
      }
      size += b.getPossibleMemoryConsumed();
      accountedBuffers.put(udle, null);
      break;
    default:
      throw new UnsupportedOperationException("Invalid case: " + type.name());
    }
  }
  return size;
}
项目:drill    文件:BaseAllocator.java   
private void dumpBuffers(final StringBuilder sb, final Set<BufferLedger> ledgerSet) {
  for (final BufferLedger ledger : ledgerSet) {
    if (!ledger.isOwningLedger()) {
      continue;
    }
    final UnsafeDirectLittleEndian udle = ledger.getUnderlying();
    sb.append("UnsafeDirectLittleEndian[dentityHashCode == ");
    sb.append(Integer.toString(System.identityHashCode(udle)));
    sb.append("] size ");
    sb.append(Integer.toString(udle.capacity()));
    sb.append('\n');
  }
}
项目:drill    文件:AllocationManager.java   
/**
 * Package visible for debugging/verification only.
 */
@VisibleForTesting
protected UnsafeDirectLittleEndian getUnderlying() {
  return underlying;
}
项目:drill    文件:BaseAllocator.java   
/**
 * Verifies the accounting state of the allocator. Only works for DEBUG.
 *
 * @throws IllegalStateException
 *           when any problems are found
 */
void verifyAllocator() {
  final IdentityHashMap<UnsafeDirectLittleEndian, BaseAllocator> buffersSeen = new IdentityHashMap<>();
  verifyAllocator(buffersSeen);
}