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();
}
}
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();
}
Aggregations