private void updateFragmentation() { long freeSize = this.ma.getStats().getFreeMemory(); // Calculate free space fragmentation only if there is free space available. if(freeSize > 0) { long largestFragment = this.ma.getStats().getLargestFragment(); long numerator = freeSize - largestFragment; double percentage = (double) numerator / (double) freeSize; percentage *= 100d; int wholePercentage = (int) Math.rint(percentage); this.ma.getStats().setFragmentation(wholePercentage); } else { // No free space? Then we have no free space fragmentation. this.ma.getStats().setFragmentation(0); } }
public static byte[] getBaseRowBytes(final UnsafeWrapper unsafe, final long baseAddr, final int bytesLen) { // If the row does not have any lobs, the offheap byte source is not // serialized, else it is serialized byte[] result = new byte[bytesLen]; UnsafeMemoryChunk.readUnsafeBytes(unsafe, baseAddr, result, bytesLen); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; }
public static byte[] getBaseRowBytes(final UnsafeWrapper unsafe, final long baseAddr, final int bytesLen) { // If the row does not have any lobs, the offheap byte source is not // serialized, else it is serialized byte[] result = new byte[bytesLen]; UnsafeMemoryChunk.readUnsafeBytes(unsafe, baseAddr, result, bytesLen); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; }
public static byte[] getBaseRowBytes(final long baseAddr, final int bytesLen) { // If the row does not have any lobs, the offheap byte source is not // serialized, else it is serialized byte[] result = new byte[bytesLen]; UnsafeMemoryChunk.readUnsafeBytes(baseAddr, result, bytesLen); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; }
public final void serializeGfxdBytesWithStats(int index, DataOutput out) throws IOException { serializeGfxdBytes(index, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
public final void serializeGfxdBytesWithStats(int index, DataOutput out) throws IOException { serializeGfxdBytes(index, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
public final void serializeGfxdBytesWithStats(int index, DataOutput out) throws IOException { serializeGfxdBytes(index, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
public static void serializeBaseRowBytes(final UnsafeWrapper unsafe, final long baseAddr, final int bytesLen, final DataOutput out) throws IOException { // If the row does not have any lobs, the offheap byte source is not // serialized, else it is serialized InternalDataSerializer.writeArrayLength(bytesLen, out); OffHeapRegionEntryHelper.copyBytesToDataOutput(unsafe, baseAddr, bytesLen, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
public static void serializeBaseRowBytes(final UnsafeWrapper unsafe, final long baseAddr, final int bytesLen, final DataOutput out) throws IOException { // If the row does not have any lobs, the offheap byte source is not // serialized, else it is serialized InternalDataSerializer.writeArrayLength(bytesLen, out); OffHeapRegionEntryHelper.copyBytesToDataOutput(unsafe, baseAddr, bytesLen, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
/** * Returns the raw possibly compressed bytes of this chunk */ public byte[] getCompressedBytes() { byte[] result = new byte[getDataSize()]; readBytes(0, result); //debugLog("reading", true); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; } protected byte[] getRawBytes() {
final byte[] getFullDataBytes() { int dataSize = getDataSize(); byte[] result = new byte[dataSize]; super.readBytes(0, result, 0, dataSize); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; }
final byte[] getFullDataBytes() { int dataSize = getDataSize(); byte[] result = new byte[dataSize]; super.readBytes(0, result, 0, dataSize); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; }
public static void serializeBaseRowBytes(final UnsafeWrapper unsafe, final long baseAddr, final int bytesLen, final DataOutput out) throws IOException { // If the row does not have any lobs, the offheap byte source is not // serialized, else it is serialized InternalDataSerializer.writeArrayLength(bytesLen, out); OffHeapRegionEntryHelper.copyBytesToDataOutput(unsafe, baseAddr, bytesLen, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
final byte[] getFullDataBytes() { int dataSize = getDataSize(); byte[] result = new byte[dataSize]; super.readBytes(0, result, 0, dataSize); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); return result; }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); region.destroy(key, arg); assertEquals(1, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(1, ma.getStats().getObjects()); } } });
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); region.put(key, newValue, arg); assertEquals(2, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(2, ma.getStats().getObjects()); } } });
protected byte[] getRawBytes() { byte[] result = new byte[getDataSize()]; readBytes(0, result); //debugLog("reading", true); getAllocator().getStats().incReads(); if (isCompressed()) { result = getAllocator().getCompressor().decompress(result); } return result; }
public void toData(final DataOutput out) throws IOException { if (GemFireXDUtils.TraceRSIter) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_RSITER, "OffHeapByteSource.toData: serializing offheap byte source=" + this); } final UnsafeWrapper unsafe = UnsafeMemoryChunk.getUnsafeWrapper(); final int offsetAdjustment = getOffsetAdjustment(); final int len = getDataSize(unsafe, this.memoryAddress) - offsetAdjustment; serializeBaseRowBytes(unsafe, getBaseDataAddress() + offsetAdjustment, len, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
public void toData(final DataOutput out) throws IOException { if (GemFireXDUtils.TraceRSIter) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_RSITER, "OffHeapByteSource.toData: serializing offheap byte source=" + this); } final UnsafeWrapper unsafe = UnsafeMemoryChunk.getUnsafeWrapper(); final int offsetAdjustment = getOffsetAdjustment(); final int len = getDataSize(unsafe, this.memoryAddress) - offsetAdjustment; serializeBaseRowBytes(unsafe, getBaseDataAddress() + offsetAdjustment, len, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }
public void toData(final DataOutput out) throws IOException { if (GemFireXDUtils.TraceRSIter) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_RSITER, "OffHeapByteSource.toData: serializing offheap byte source=" + this); } final UnsafeWrapper unsafe = UnsafeMemoryChunk.getUnsafeWrapper(); final int offsetAdjustment = getOffsetAdjustment(); final int len = getDataSize(unsafe, this.memoryAddress) - offsetAdjustment; serializeBaseRowBytes(unsafe, getBaseDataAddress() + offsetAdjustment, len, out); SimpleMemoryAllocatorImpl.getAllocator().getStats().incReads(); }