Search in sources :

Example 1 with HeapDumpFormatter

use of com.ibm.jvm.dtfjview.heapdump.HeapDumpFormatter in project openj9 by eclipse.

the class HeapdumpCommand method dumpMultipleHeapsInSeparateFiles.

private void dumpMultipleHeapsInSeparateFiles(JavaRuntime runtime, String version, boolean is64Bit, boolean phdFormat, String baseFileName, Set heapsToDump) throws IOException {
    Iterator heapIterator = runtime.getHeaps();
    HeapDumpFormatter formatter = null;
    while (heapIterator.hasNext()) {
        Object thisHeapObj = heapIterator.next();
        if (thisHeapObj instanceof CorruptData) {
            out.println("Heap corrupted at: " + ((CorruptData) thisHeapObj).getAddress());
            _numberOfErrors++;
            continue;
        }
        JavaHeap thisHeap = (JavaHeap) thisHeapObj;
        // Create a new heapdump formatter for every heap we find
        if (formatter != null) {
            formatter.close();
        }
        if (heapsToDump.size() > 0 && !heapsToDump.contains(thisHeap.getName())) {
            continue;
        }
        String fileName = getFileNameForHeap(thisHeap, baseFileName);
        out.print("Writing " + (phdFormat ? "PHD" : "Classic") + " format heapdump for heap " + thisHeap.getName() + " into " + fileName + "\n");
        formatter = getFormatter(fileName, version, is64Bit, phdFormat);
        // We have to dump classes in every heapdump
        dumpClasses(formatter, runtime);
        dumpHeap(formatter, thisHeap);
    }
    if (formatter != null) {
        formatter.close();
    }
}
Also used : PortableHeapDumpFormatter(com.ibm.jvm.dtfjview.heapdump.portable.PortableHeapDumpFormatter) ClassicHeapDumpFormatter(com.ibm.jvm.dtfjview.heapdump.classic.ClassicHeapDumpFormatter) HeapDumpFormatter(com.ibm.jvm.dtfjview.heapdump.HeapDumpFormatter) JavaHeap(com.ibm.dtfj.java.JavaHeap) ReferenceIterator(com.ibm.jvm.dtfjview.heapdump.ReferenceIterator) Iterator(java.util.Iterator) LongListReferenceIterator(com.ibm.jvm.dtfjview.heapdump.LongListReferenceIterator) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData)

Example 2 with HeapDumpFormatter

use of com.ibm.jvm.dtfjview.heapdump.HeapDumpFormatter in project openj9 by eclipse.

the class HeapdumpCommand method dumpMultipleHeapsInOneFile.

private void dumpMultipleHeapsInOneFile(JavaRuntime runtime, String version, boolean is64Bit, boolean phdFormat, String filename, Set heapsToDump) throws IOException {
    Iterator heapIterator = runtime.getHeaps();
    HeapDumpFormatter formatter = getFormatter(filename, version, is64Bit, phdFormat);
    out.println("Writing " + (phdFormat ? "PHD" : "Classic") + " format heapdump into " + filename);
    while (heapIterator.hasNext()) {
        Object thisHeapObj = heapIterator.next();
        if (thisHeapObj instanceof CorruptData) {
            out.println("Corrupt heap data found at: " + ((CorruptData) thisHeapObj).getAddress());
            _numberOfErrors++;
            continue;
        }
        JavaHeap thisHeap = (JavaHeap) thisHeapObj;
        if (heapsToDump.size() > 0 && !heapsToDump.contains(thisHeap.getName())) {
            continue;
        }
        dumpHeap(formatter, thisHeap);
    }
    dumpClasses(formatter, runtime);
    formatter.close();
}
Also used : PortableHeapDumpFormatter(com.ibm.jvm.dtfjview.heapdump.portable.PortableHeapDumpFormatter) ClassicHeapDumpFormatter(com.ibm.jvm.dtfjview.heapdump.classic.ClassicHeapDumpFormatter) HeapDumpFormatter(com.ibm.jvm.dtfjview.heapdump.HeapDumpFormatter) JavaHeap(com.ibm.dtfj.java.JavaHeap) ReferenceIterator(com.ibm.jvm.dtfjview.heapdump.ReferenceIterator) Iterator(java.util.Iterator) LongListReferenceIterator(com.ibm.jvm.dtfjview.heapdump.LongListReferenceIterator) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData)

Aggregations

CorruptData (com.ibm.dtfj.image.CorruptData)2 JavaHeap (com.ibm.dtfj.java.JavaHeap)2 JavaObject (com.ibm.dtfj.java.JavaObject)2 HeapDumpFormatter (com.ibm.jvm.dtfjview.heapdump.HeapDumpFormatter)2 LongListReferenceIterator (com.ibm.jvm.dtfjview.heapdump.LongListReferenceIterator)2 ReferenceIterator (com.ibm.jvm.dtfjview.heapdump.ReferenceIterator)2 ClassicHeapDumpFormatter (com.ibm.jvm.dtfjview.heapdump.classic.ClassicHeapDumpFormatter)2 PortableHeapDumpFormatter (com.ibm.jvm.dtfjview.heapdump.portable.PortableHeapDumpFormatter)2 Iterator (java.util.Iterator)2