Instance getNearestGCRootPointer(Instance instance) { if (heap.getGCRoot(instance) != null) { return instance; } computeGCRoots(); long nextGCPathId = heap.idToOffsetMap.get(instance.getInstanceId()).getNearestGCRootPointer(); return heap.getInstanceByID(nextGCPathId); }
private String getStringByOffset(long offset) { long stringID = getHprofBuffer().getID(fileOffset + offset); return stackFrameSegment.hprofHeap.getStringSegment().getStringByID(stringID); } }
String getClassName() { int classSerial = getHprofBuffer().getInt(fileOffset + stackFrameSegment.classSerialNumberOffset); LoadClass loadClass = stackFrameSegment.hprofHeap.getLoadClassSegment().getClassBySerialNumber(classSerial); return loadClass.getName(); }
public List<Object> getValues() { HprofByteBuffer dumpBuffer = dumpClass.getHprofBuffer(); HprofHeap heap = dumpClass.getHprof(); byte type = getType(); long offset = getArrayStartOffset(); return new PrimitiveArrayLazyList(dumpBuffer, getLength(), offset, heap.getValueSize(type), type); }
HprofHeap(File dumpFile, int seg) throws FileNotFoundException, IOException { dumpBuffer = HeapFactory.createHprofByteBuffer(dumpFile, HeapFactory.DEFAULT_BUFFER); segment = seg; fillTagBounds(dumpBuffer.getHeaderSize()); heapDumpSegment = computeHeapDumpStart(); if (heapDumpSegment != null) { fillHeapTagBounds(); } idToOffsetMap = initIdMap(); nearestGCRoot = new NearestGCRoot(this); }
StackFrame[] getStackFrames() { HprofByteBuffer buf = getHprofBuffer(); int frames = buf.getInt(fileOffset + stackTraceSegment.numberOfFramesOffset); StackFrame[] fr = new StackFrame[frames]; long idOffset = fileOffset + stackTraceSegment.framesListOffset; StackFrameSegment stackFrameSegment = stackTraceSegment.hprofHeap.getStackFrameSegment(); for (int i=0;i<frames;i++,idOffset+=buf.getIDSize()) { long frameID = buf.getID(idOffset); fr[i] = stackFrameSegment.getStackFrameByID(frameID); } return fr; }
public List<Instance> getValues() { HprofByteBuffer dumpBuffer = dumpClass.getHprofBuffer(); HprofHeap heap = dumpClass.getHprof(); return new ObjectArrayLazyList(heap, dumpBuffer, getLength(), getOffset()); }
@Override public List<Long> getValueIDs() { HprofByteBuffer dumpBuffer = dumpClass.getHprofBuffer(); HprofHeap heap = dumpClass.getHprof(); return new ObjectIdArrayLazyList(heap, dumpBuffer, getLength(), getOffset()); }
public List<Instance> getValuesSortedByID() { HprofByteBuffer dumpBuffer = dumpClass.getHprofBuffer(); HprofHeap heap = dumpClass.getHprof(); return new ObjectArraySortedList(heap, dumpBuffer, getLength(), getOffset()); }
void setLoadClassOffsets() { ClassDumpSegment classDumpSegment = hprofHeap.getClassDumpSegment(); long[] offset = new long[] { startOffset }; while (offset[0] < endOffset) { long start = offset[0]; long classID = readLoadClassID(offset); ClassDump classDump = classDumpSegment.getClassDumpByID(classID); if (classDump != null) { classDump.setClassLoadOffset(start); } } }
public int getInstanceSize() { if (isArray()) { return -1; } return classDumpSegment.getMinimumInstanceSize() + getHprofBuffer().getInt(fileOffset + classDumpSegment.instanceSizeOffset); }
char[] getChars(int start, int length) { assert getType() == HprofHeap.CHAR; char[] chars = new char[length]; long offset = getArrayStartOffset() + ((long)start * (long)charSize); HprofByteBuffer dumpBuffer = dumpClass.getHprofBuffer(); for (int i = 0; i < length; i++) { chars[i] = dumpBuffer.getChar(offset + (i * charSize)); } return chars; }
public Instance getInstance() { HprofHeap heap = dumpClass.getHprof(); HprofByteBuffer dumpBuffer = heap.dumpBuffer; int idSize = dumpBuffer.getIDSize(); long instanceId = dumpBuffer.getID(instanceArrayOffset + 1 + idSize + 4 + 4 + idSize + ((long)index * (long)idSize)); return heap.getInstanceByID(instanceId); } }
Object getTypeValue() { HprofByteBuffer dumpBuffer = classDump.getHprofBuffer(); long position = fileOffset + classDump.classDumpSegment.fieldTypeOffset; byte type = dumpBuffer.get(position); return HprofInstanceValue.getTypeValue(dumpBuffer, position + 1, type); } }
private long readStringTag(long[] offset) { long start = offset[0]; if (hprofHeap.readTag(offset) != HprofHeap.STRING) { return 0; } return getDumpBuffer().getID(start + stringIDOffset); }
private long readStackFrameTag(long[] offset) { long start = offset[0]; if (hprofHeap.readTag(offset) != HprofHeap.STACK_FRAME) { return 0; } return getDumpBuffer().getID(start + stackFrameIDOffset); } }
private int readLoadClassSerialNumber(long[] offset) { long start = offset[0]; if (hprofHeap.readTag(offset) != HprofHeap.LOAD_CLASS) { return 0; } return getDumpBuffer().getInt(start + classSerialNumberOffset); }
private long readLoadClassID(long[] offset) { long start = offset[0]; if (hprofHeap.readTag(offset) != HprofHeap.LOAD_CLASS) { return 0; } return getDumpBuffer().getID(start + classIDOffset); } }
Object getTypeValue() { byte type = field.getValueType(); HprofByteBuffer dumpBuffer = instance.dumpClass.getHprofBuffer(); return getTypeValue(dumpBuffer, fileOffset, type); }
HprofHeap(HprofByteBuffer buffer, int seg) throws FileNotFoundException, IOException { dumpBuffer = buffer; segment = seg; fillTagBounds(dumpBuffer.getHeaderSize()); heapDumpSegment = computeHeapDumpStart(); if (heapDumpSegment != null) { fillHeapTagBounds(); } idToOffsetMap = initIdMap(); nearestGCRoot = new NearestGCRoot(this); }