public AsIterable(HprofHeap heap) { this.heap = heap; this.start = heap.getAllInstanceDumpBounds().startOffset; }
public HprofInstanceIterator(HprofHeap heap, long start) { this.heap = heap; allInstanceDumpBounds = heap.getAllInstanceDumpBounds(); pointer = new long[]{start}; dumpBuffer = heap.dumpBuffer; nextInstance = seek(); }
public HeapOffsetMap(HprofHeap heap) { this.heap = heap; this.dumpBuffer = heap.dumpBuffer; TagBounds bounds = heap.getAllInstanceDumpBounds(); pointer[0] = bounds.startOffset; cidOffset = readID(); if (cidOffset % allignment != 0) { throw new IllegalArgumentException("Allignment violated for " + cidOffset); } // avoid signed arithmetic cidOffset = cidOffset >>> allignmentBits; long span = bounds.endOffset - bounds.startOffset; // rough estimate offsetMap = new long[(int)((span) / (pageAddessSpan)) + 1]; offsetMap[0] = bounds.startOffset; cachePageId = new int[DEFAULT_CACHE_SIZE]; cachePageData = new int[cachePageId.length][pageSize]; Arrays.fill(cachePageId, -1); }
static void scan(HprofHeap heap) { long[] pointer = new long[1]; TagBounds bounds = heap.getAllInstanceDumpBounds(); pointer[0] = bounds.startOffset; while(pointer[0] < bounds.endOffset) { long ptr = pointer[0]; int tag = heap.readDumpTag(pointer); if ( tag == HprofHeap.INSTANCE_DUMP || tag == HprofHeap.OBJECT_ARRAY_DUMP || tag == HprofHeap.PRIMITIVE_ARRAY_DUMP) { long iid = heap.dumpBuffer.getID(ptr + 1); System.out.println(ptr + " - " + iid); } } }
private long readID() { TagBounds bounds = heap.getAllInstanceDumpBounds(); while(pointer[0] < bounds.endOffset) { long ptr = pointer[0]; int tag = heap.readDumpTag(pointer); if ( tag == HprofHeap.INSTANCE_DUMP || tag == HprofHeap.OBJECT_ARRAY_DUMP || tag == HprofHeap.PRIMITIVE_ARRAY_DUMP) { return dumpBuffer.getID(ptr + 1); } } return -1; }
private void readPage(long id, long offset, int[] cachePage) { TagBounds bounds = heap.getAllInstanceDumpBounds(); pointer[0] = offset; Arrays.fill(cachePage, -1);
if (noffs >= heap.getAllInstanceDumpBounds().endOffset) { offsetMap = Arrays.copyOf(offsetMap, maxPage + 1); offsetMap[maxPage] = heap.getAllInstanceDumpBounds().endOffset; if (n < page) { if (nestedScan) {
public AsIterable(HprofHeap heap) { this.heap = heap; this.start = heap.getAllInstanceDumpBounds().startOffset; }
public HprofInstanceIterator(HprofHeap heap, long start) { this.heap = heap; allInstanceDumpBounds = heap.getAllInstanceDumpBounds(); pointer = new long[]{start}; dumpBuffer = heap.dumpBuffer; nextInstance = seek(); }
public HeapOffsetMap(HprofHeap heap) { this.heap = heap; this.dumpBuffer = heap.dumpBuffer; TagBounds bounds = heap.getAllInstanceDumpBounds(); pointer[0] = bounds.startOffset; cidOffset = readID(); if (cidOffset % allignment != 0) { throw new IllegalArgumentException("Allignment violated for " + cidOffset); } // avoid signed arithmetic cidOffset = cidOffset >>> allignmentBits; long span = bounds.endOffset - bounds.startOffset; // rough estimate offsetMap = new long[(int)((span) / (pageAddessSpan)) + 1]; offsetMap[0] = bounds.startOffset; cachePageId = new int[DEFAULT_CACHE_SIZE]; cachePageData = new int[cachePageId.length][pageSize]; Arrays.fill(cachePageId, -1); }
static void scan(HprofHeap heap) { long[] pointer = new long[1]; TagBounds bounds = heap.getAllInstanceDumpBounds(); pointer[0] = bounds.startOffset; while(pointer[0] < bounds.endOffset) { long ptr = pointer[0]; int tag = heap.readDumpTag(pointer); if ( tag == HprofHeap.INSTANCE_DUMP || tag == HprofHeap.OBJECT_ARRAY_DUMP || tag == HprofHeap.PRIMITIVE_ARRAY_DUMP) { long iid = heap.dumpBuffer.getID(ptr + 1); System.out.println(ptr + " - " + iid); } } }
private long readID() { TagBounds bounds = heap.getAllInstanceDumpBounds(); while(pointer[0] < bounds.endOffset) { long ptr = pointer[0]; int tag = heap.readDumpTag(pointer); if ( tag == HprofHeap.INSTANCE_DUMP || tag == HprofHeap.OBJECT_ARRAY_DUMP || tag == HprofHeap.PRIMITIVE_ARRAY_DUMP) { return dumpBuffer.getID(ptr + 1); } } return -1; }
private void readPage(long id, long offset, int[] cachePage) { TagBounds bounds = heap.getAllInstanceDumpBounds(); pointer[0] = offset; Arrays.fill(cachePage, -1);
if (noffs >= heap.getAllInstanceDumpBounds().endOffset) { offsetMap = Arrays.copyOf(offsetMap, maxPage + 1); offsetMap[maxPage] = heap.getAllInstanceDumpBounds().endOffset; if (n < page) { if (nestedScan) {
int idSize = dumpBuffer.getIDSize(); List instancesList = new ArrayList(instancesCount); TagBounds allInstanceDumpBounds = heap.getAllInstanceDumpBounds(); long[] offset = new long[] { firstInstanceOffset };