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; }
@Override public void initialize(OffHeapMemoryStats oldStats) { setFreeMemory(oldStats.getFreeMemory()); setMaxMemory(oldStats.getMaxMemory()); setUsedMemory(oldStats.getUsedMemory()); setObjects(oldStats.getObjects()); setReads(oldStats.getReads()); setCompactions(oldStats.getCompactions()); setFragments(oldStats.getFragments()); setLargestFragment(oldStats.getLargestFragment()); setCompactionTime(oldStats.getCompactionTime()); setFragmentation(oldStats.getFragmentation()); oldStats.close(); }
private void logOffHeapState(int chunkSize) { if (InternalDistributedSystem.getAnyInstance() != null) { LogWriter lw = InternalDistributedSystem.getAnyInstance().getLogWriter(); lw.info("OutOfOffHeapMemory allocating size of " + chunkSize + ". allocated=" + this.allocatedSize.get() + " compactions=" + this.compactCount.get() + " objects=" + this.ma.stats.getObjects() + " free=" + this.ma.stats.getFreeMemory() + " fragments=" + this.ma.stats.getFragments() + " largestFragment=" + this.ma.stats.getLargestFragment() + " fragmentation=" + this.ma.stats.getFragmentation()); logFragmentState(lw); logTinyState(lw); logHugeState(lw); } }
public int getOffHeapObjects() { int objects = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { objects = stats.getObjects(); } return objects; }
final long startCompactionTime = getStats().startCompaction(); final int countPreSync = this.compactCount.get(); try { getStats().setLargestFragment(largestFragment); getStats().setFragments(tmp.size()); updateFragmentation(); getStats().endCompaction(startCompactionTime);
/** Verify that compaction occurred and its count is one more than the previous stat value. * * @param stats The off-heap memory stats to use to check for compaction. * @param previousNumCompactions The expected number of compactions should be greater than this number. */ private static void verifyCompaction(OffHeapMemoryStats stats, long previousNumCompactions) { long compactions = stats.getCompactions(); long compactionTime = stats.getCompactionTime(); Log.getLogWriter().info("Compactions (from stats): " + compactions); Log.getLogWriter().info("Compaction time (from stats): " + compactionTime); if (compactions <= previousNumCompactions) { throw new TestException("Expected compactions stat to be " + previousNumCompactions + ", but it is " + compactions); } if (compactionTime <= 0) { throw new TestException("Expected compactionTime stat to be > 0, but it is " + compactionTime); } }
} else { OffHeapMemoryStats offHeapStats = OffHeapHelper.getOffHeapMemoryStats(); long totalOffHeapSizeInBytes = offHeapStats.getMaxMemory(); long thresholdInBytes = (long) (totalOffHeapSizeInBytes * 0.30); Set<Region<?, ?>> regionSet = getAllRegions(); while (true) { for (Region aRegion: regionSet) { long currentOffHeapSizeInBytes = offHeapStats.getUsedMemory();; Log.getLogWriter().info("currentOffHeapSizeinBytes = " + currentOffHeapSizeInBytes + ", threshold in bytes is " + thresholdInBytes); if (currentOffHeapSizeInBytes < thresholdInBytes) {
@Override public void initialize(OffHeapMemoryStats stats) { stats.close(); } }
public long getOffHeapUsedMemory() { long usedSize = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { usedSize = stats.getUsedMemory(); } return usedSize; }
public long getOffHeapCompactionTime() { long compactionTime = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { compactionTime = stats.getCompactionTime(); } return compactionTime; }
public long getOffHeapMaxMemory() { long usedSize = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { usedSize = stats.getMaxMemory(); } return usedSize; }
Set<Region<?, ?>> regionSet = getAllRegions(); OffHeapMemoryStats stats = OffHeapHelper.getOffHeapMemoryStats(); long previousNumCompactions = stats.getCompactions(); while (true) { for (Region aRegion: regionSet) {
public int getOffHeapFragmentation() { int fragmentation = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { fragmentation = stats.getFragmentation(); } return fragmentation; }
private void logOffHeapState(int chunkSize) { if (InternalDistributedSystem.getAnyInstance() != null) { LogWriter lw = InternalDistributedSystem.getAnyInstance().getLogWriter(); lw.info("OutOfOffHeapMemory allocating size of " + chunkSize + ". allocated=" + this.allocatedSize.get() + " compactions=" + this.compactCount.get() + " objects=" + stats.getObjects() + " free=" + stats.getFreeMemory() + " fragments=" + stats.getFragments() + " largestFragment=" + stats.getLargestFragment() + " fragmentation=" + stats.getFragmentation()); logFragmentState(lw); logTinyState(lw); // logBigState(lw); logHugeState(lw); } }
public int getOffHeapObjects() { int objects = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { objects = stats.getObjects(); } return objects; }
final long startCompactionTime = this.ma.getStats().startCompaction(); final int countPreSync = this.compactCount.get(); try { this.ma.getStats().setLargestFragment(largestFragment); this.ma.getStats().setFragments(tmp.size()); updateFragmentation(); this.ma.getStats().endCompaction(startCompactionTime);
private void realClose() { // Removing this memory immediately can lead to a SEGV. See 47885. if (setClosed()) { freeSlabsAsync(this.slabs); this.stats.close(); singleton = null; } }
public long getOffHeapUsedMemory() { long usedSize = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { usedSize = stats.getUsedMemory(); } return usedSize; }
public long getOffHeapCompactionTime() { long compactionTime = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { compactionTime = stats.getCompactionTime(); } return compactionTime; }
public long getOffHeapMaxMemory() { long usedSize = 0; OffHeapMemoryStats stats = getOffHeapStats(); if(null != stats) { usedSize = stats.getMaxMemory(); } return usedSize; }