use of com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper in project openj9 by eclipse.
the class DumpAllRamClassLinearCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long nestingThreashold;
if (args.length > 1) {
throw new DDRInteractiveCommandException("This debug extension accepts none or one argument!");
} else if (args.length == 1) {
nestingThreashold = Long.valueOf(args[0]);
} else {
nestingThreashold = 1;
}
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
if (null != vm) {
out.println();
out.println("!j9javavm " + vm.getHexAddress());
} else {
throw new DDRInteractiveCommandException("Unable to find the VM in core dump!");
}
out.println();
ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
while (classSegmentIterator.hasNext()) {
J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
out.println("!dumpramclasslinear " + classPointer.getHexAddress());
// RAM Class 'org/apache/tomcat/util/buf/MessageBytes' at 0x0DCF9008:
out.println(String.format("RAM Class '%s' at %s", J9ClassHelper.getJavaName(classPointer), classPointer.getHexAddress()));
out.println();
ClassWalker classWalker = new RamClassWalker(classPointer, context);
new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreashold);
out.println();
}
} catch (CorruptDataException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper in project openj9 by eclipse.
the class DumpRomClassLinearCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length == 0)
throw new DDRInteractiveCommandException("This debug extension needs an address argument !dumpromclasslinear <addr>[,n]");
String[] arguments = args[0].split(",");
long addr = Long.decode(arguments[0]);
long nestingThreshold;
if (arguments.length > 1) {
nestingThreshold = Long.decode(arguments[1]);
} else {
nestingThreshold = 1;
}
J9ROMClassPointer clazz = J9ROMClassPointer.cast(addr);
try {
// ROM Class 'org/apache/tomcat/util/buf/MessageBytes' at 0x0DCF9008:
out.println(String.format("ROM Class '%s' at %s", J9UTF8Helper.stringValue(clazz.className()), clazz.getHexAddress()));
ClassWalker classWalker = new RomClassWalker(clazz, context);
new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreshold);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper in project openj9 by eclipse.
the class DumpAllRomClassLinearCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long nestingThreashold;
if (args.length > 1) {
throw new DDRInteractiveCommandException("This debug extension accepts none or one argument!");
} else if (args.length == 1) {
nestingThreashold = Long.valueOf(args[0]);
} else {
nestingThreashold = 1;
}
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
if (null != vm) {
out.println();
out.println("!j9javavm " + vm.getHexAddress());
} else {
throw new DDRInteractiveCommandException("Unable to find the VM in core dump!");
}
out.println();
ROMClassesIterator iterator = new ROMClassesIterator(out, vm.classMemorySegments());
while (iterator.hasNext()) {
J9ROMClassPointer classPointer = iterator.next();
out.println("!dumpromclasslinear " + classPointer.getHexAddress());
// ROM Class 'org/apache/tomcat/util/buf/MessageBytes' at 0x0DCF9008:
out.println(String.format("ROM Class '%s' at %s", J9UTF8Helper.stringValue(classPointer.className()), classPointer.getHexAddress()));
out.println();
ClassWalker classWalker = new RomClassWalker(classPointer, context);
new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreashold);
out.println();
}
} catch (CorruptDataException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper in project openj9 by eclipse.
the class RomClassSummaryCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
boolean requiredLocal = false;
boolean requiredShared = false;
boolean required16bitnas = false;
J9SharedClassConfigPointer sc = J9SharedClassConfigPointer.NULL;
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
long startAddress = 0, endAddress = 0;
if ((args != null) && (args.length >= 1)) {
if (args[0].equals("shared")) {
requiredShared = true;
} else if (args[0].equals("local")) {
requiredLocal = true;
} else if (args[0].equals("16bitnas")) {
required16bitnas = true;
} else {
out.println("USAGE: !romclasssummary [local|shared] [16bitnas]");
return;
}
if ((args.length >= 2) && (args[1].equals("16bitnas"))) {
required16bitnas = true;
}
if (requiredShared || requiredLocal) {
sc = vm.sharedClassConfig();
if (requiredShared && sc.isNull()) {
out.println("The request for '" + args[0] + " classes' failed, because " + "shared classes were not enabled on that dump file.");
return;
}
if (sc.notNull()) {
startAddress = UDATA.cast(sc.cacheDescriptorList().romclassStartAddress()).longValue();
J9SharedCacheHeaderPointer header = sc.cacheDescriptorList().cacheStartAddress();
endAddress = UDATA.cast(header).add(header.segmentSRP()).longValue();
}
}
}
ClassSummaryHelper classSummaryHelper = new ClassSummaryHelper(preferredOrder);
Statistics statistics = new Statistics();
ROMClassesIterator classSegmentIterator = new ROMClassesIterator(out, vm.classMemorySegments());
while (classSegmentIterator.hasNext()) {
J9ROMClassPointer classPointer = (J9ROMClassPointer) classSegmentIterator.next();
if (requiredShared || requiredLocal) {
boolean isShared;
if (sc.notNull()) {
long classAddress = classPointer.getAddress();
isShared = classAddress >= startAddress && classAddress < endAddress;
} else {
isShared = false;
}
if (requiredShared && !isShared)
continue;
if (requiredLocal && isShared)
continue;
}
ClassWalker classWalker = new RomClassWalker(classPointer, context);
LinearDumper linearDumper = new LinearDumper();
J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
classSummaryHelper.addRegionsForClass(allRegionsNode);
if (required16bitnas) {
statistics.add(allRegionsNode);
}
}
classSummaryHelper.printStatistics(out);
if (statistics.nameAndSignatureSRP16bitSize != -1) {
out.println();
out.println("<Total 16bit nameAndSignatureSRPs Size>");
out.println(statistics.nameAndSignatureSRP16bitSize);
}
if (statistics.nameAndSignatureSRPCount != -1 && statistics.cpFieldNASCount != -1) {
out.println();
out.println("<Shared nameAndSignatureSRPs>");
// nameAndSignatureSRPCount is divided by 2, because there is a name and a signature per NAS field
out.println(statistics.cpFieldNASCount - statistics.nameAndSignatureSRPCount / 2);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper in project openj9 by eclipse.
the class RamClassSummaryCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
ClassSummaryHelper classSummaryHelper = new ClassSummaryHelper(preferredOrder);
ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
while (classSegmentIterator.hasNext()) {
J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
numberOfClasses++;
ClassWalker classWalker = new RamClassWalker(classPointer, context);
LinearDumper linearDumper = new LinearDumper();
J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
classSummaryHelper.addRegionsForClass(allRegionsNode);
}
classSummaryHelper.printStatistics(out);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations