use of com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker 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);
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker in project openj9 by eclipse.
the class AnalyseRomClassUTF8Command method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
boolean printUTF8WeightList = false;
int maxDistributionPercent = 85;
if ((args.length >= 1) && (args[0].equals("UTF8WeightList"))) {
printUTF8WeightList = true;
}
for (int i = 0; i < args.length; i++) {
if (args[i].endsWith("%")) {
try {
// Parses the maxDistribution string such as 85%
maxDistributionPercent = DecimalFormat.getInstance().parse(args[i]).intValue();
} catch (ParseException e) {
out.println("Usage: !analyseromClassutf8 [UTF8WeightList] [maxDistribution%] maxDistribution defaults to 85%");
}
}
}
Statistics statistics = new Statistics();
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
ROMClassesIterator classSegmentIterator = new ROMClassesIterator(out, vm.classMemorySegments());
J9ObjectPointer bootstraploader = vm.systemClassLoader().classLoaderObject();
while (classSegmentIterator.hasNext()) {
J9ROMClassPointer classPointer = (J9ROMClassPointer) classSegmentIterator.next();
ClassWalker classWalker = new RomClassWalker(classPointer, context);
LinearDumper linearDumper = new LinearDumper();
J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
statistics.add(allRegionsNode, classSegmentIterator, bootstraploader);
}
statistics.getResult(printUTF8WeightList, maxDistributionPercent, out);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker in project openj9 by eclipse.
the class DumpRamClassLinearCommand 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 !dumpramclasslinear <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;
}
J9ClassPointer clazz = J9ClassPointer.cast(addr);
try {
out.println(String.format("RAM Class '%s' at %s", J9UTF8Helper.stringValue(clazz.romClass().className()), clazz.getHexAddress()));
ClassWalker classWalker = new RamClassWalker(clazz, context);
new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreshold);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker in project openj9 by eclipse.
the class QueryRomClassCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length == 0) {
printUsage(out);
return;
}
try {
String[] queries = args[0].split(",");
long address = CommandUtils.parsePointer(queries[0], J9BuildFlags.env_data64);
J9ROMClassPointer romClass = J9ROMClassPointer.cast(address);
queries[0] = "";
ClassWalker classWalker = new RomClassWalker(romClass, context);
LinearDumper linearDumper = new LinearDumper();
J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
for (String query : queries) {
if (query.length() != 0) {
queryROMClass(out, romClass, query, allRegionsNode);
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations