本文整理了Java中io.prestosql.spi.block.Block.getRetainedSizeInBytes()
方法的一些代码示例,展示了Block.getRetainedSizeInBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getRetainedSizeInBytes()
方法的具体详情如下:
包路径:io.prestosql.spi.block.Block
类名称:Block
方法名:getRetainedSizeInBytes
[英]Returns the retained size of this block in memory, including over-allocations. This method is called from the inner most execution loop and must be fast.
[中]返回此块在内存中的保留大小,包括过度分配。此方法是从最内部的执行循环调用的,必须是快速的。
代码示例来源:origin: prestosql/presto
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE + value.getRetainedSizeInBytes();
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE + block.getRetainedSizeInBytes();
}
代码示例来源:origin: prestosql/presto
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE + block.getRetainedSizeInBytes();
}
代码示例来源:origin: prestosql/presto
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE + keyBlock.getRetainedSizeInBytes() + valueBlock.getRetainedSizeInBytes() + sizeOf(hashTable);
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(block, block.getRetainedSizeInBytes());
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(block, block.getRetainedSizeInBytes());
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(value, value.getRetainedSizeInBytes());
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
for (Block fieldBlock : fieldBlocks) {
consumer.accept(fieldBlock, fieldBlock.getRetainedSizeInBytes());
}
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(keyBlock, keyBlock.getRetainedSizeInBytes());
consumer.accept(valueBlock, valueBlock.getRetainedSizeInBytes());
consumer.accept(hashTable, sizeOf(hashTable));
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public long getRetainedSizeInBytes()
{
assureLoaded();
return INSTANCE_SIZE + block.getRetainedSizeInBytes();
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(dictionary, dictionary.getRetainedSizeInBytes());
consumer.accept(ids, sizeOf(ids));
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public long getRetainedSizeInBytes()
{
long retainedSizeInBytes = INSTANCE_SIZE;
for (int i = 0; i < fieldBlocks.length; i++) {
retainedSizeInBytes += getRawFieldBlock(i).getRetainedSizeInBytes();
}
return retainedSizeInBytes;
}
代码示例来源:origin: prestosql/presto
private void updateRetainedSize()
{
long retainedSizeInBytes = INSTANCE_SIZE + sizeOf(blocks);
for (Block block : blocks) {
retainedSizeInBytes += block.getRetainedSizeInBytes();
}
this.retainedSizeInBytes.set(retainedSizeInBytes);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(keyBlock, keyBlock.getRetainedSizeInBytes());
consumer.accept(valueBlock, valueBlock.getRetainedSizeInBytes());
consumer.accept(offsets, sizeOf(offsets));
consumer.accept(mapIsNull, sizeOf(mapIsNull));
consumer.accept(hashTables, sizeOf(hashTables));
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
for (int i = 0; i < numFields; i++) {
consumer.accept(fieldBlocks[i], fieldBlocks[i].getRetainedSizeInBytes());
}
consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets));
consumer.accept(rowIsNull, sizeOf(rowIsNull));
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(values, values.getRetainedSizeInBytes());
consumer.accept(offsets, sizeOf(offsets));
consumer.accept(valueIsNull, sizeOf(valueIsNull));
consumer.accept(this, (long) INSTANCE_SIZE);
}
代码示例来源:origin: prestosql/presto
/**
* Use createArrayBlockInternal or fromElementBlock instead of this method. The caller of this method is assumed to have
* validated the arguments with validateConstructorArguments.
*/
private ArrayBlock(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
{
// caller must check arguments with validateConstructorArguments
this.arrayOffset = arrayOffset;
this.positionCount = positionCount;
this.valueIsNull = valueIsNull;
this.offsets = offsets;
this.values = requireNonNull(values);
sizeInBytes = -1;
retainedSizeInBytes = INSTANCE_SIZE + values.getRetainedSizeInBytes() + sizeOf(offsets) + sizeOf(valueIsNull);
}
代码示例来源:origin: prestosql/presto
/**
* Use createRowBlockInternal or fromFieldBlocks instead of this method. The caller of this method is assumed to have
* validated the arguments with validateConstructorArguments.
*/
private RowBlock(int startOffset, int positionCount, @Nullable boolean[] rowIsNull, int[] fieldBlockOffsets, Block[] fieldBlocks)
{
super(fieldBlocks.length);
this.startOffset = startOffset;
this.positionCount = positionCount;
this.rowIsNull = rowIsNull;
this.fieldBlockOffsets = fieldBlockOffsets;
this.fieldBlocks = fieldBlocks;
this.sizeInBytes = -1;
long retainedSizeInBytes = INSTANCE_SIZE + sizeOf(fieldBlockOffsets) + sizeOf(rowIsNull);
for (Block fieldBlock : fieldBlocks) {
retainedSizeInBytes += fieldBlock.getRetainedSizeInBytes();
}
this.retainedSizeInBytes = retainedSizeInBytes;
}
代码示例来源:origin: io.prestosql/presto-main
public void compact()
{
if (eagerCompact) {
return;
}
for (int channel = 0; channel < types.size(); channel++) {
ObjectArrayList<Block> blocks = channels[channel];
for (int i = nextBlockToCompact; i < blocks.size(); i++) {
Block block = blocks.get(i);
// Copy the block to compact its size
Block compactedBlock = block.copyRegion(0, block.getPositionCount());
blocks.set(i, compactedBlock);
pagesMemorySize -= block.getRetainedSizeInBytes();
pagesMemorySize += compactedBlock.getRetainedSizeInBytes();
}
}
nextBlockToCompact = channels[0].size();
estimatedSize = calculateEstimatedSize();
}
代码示例来源:origin: io.prestosql/presto-spi
private static void checkRetainedSize(Block block, boolean getRegionCreateNewObjects)
{
AtomicLong objectSize = new AtomicLong();
Object2LongOpenCustomHashMap<Object> trackedObjects = new Object2LongOpenCustomHashMap<>(new ObjectStrategy());
BiConsumer<Object, Long> consumer = (object, size) -> {
objectSize.addAndGet(size);
trackedObjects.addTo(object, 1);
};
block.retainedBytesForEachPart(consumer);
assertEquals(objectSize.get(), block.getRetainedSizeInBytes());
Block copyBlock = block.getRegion(0, block.getPositionCount() / 2);
copyBlock.retainedBytesForEachPart(consumer);
assertEquals(objectSize.get(), block.getRetainedSizeInBytes() + copyBlock.getRetainedSizeInBytes());
assertEquals(trackedObjects.getLong(block), 1);
assertEquals(trackedObjects.getLong(copyBlock), 1);
trackedObjects.remove(block);
trackedObjects.remove(copyBlock);
for (long value : trackedObjects.values()) {
assertEquals(value, getRegionCreateNewObjects ? 1 : 2);
}
}
内容来源于网络,如有侵权,请联系作者删除!