Search in sources :

Example 6 with ClassWalker

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);
    }
}
Also used : ClassSegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator) J9ClassRegionNode(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) ClassSummaryHelper(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassSummaryHelper) ClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker) RamClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker) RamClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 7 with ClassWalker

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);
    }
}
Also used : ROMClassesIterator(com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) RomClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) J9ClassRegionNode(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) RomClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker) ClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker) ParseException(java.text.ParseException)

Example 8 with ClassWalker

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);
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) ClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker) RamClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker) RamClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 9 with ClassWalker

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);
    }
}
Also used : J9ClassRegionNode(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) ClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker) RomClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker) RomClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)8 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)8 ClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker)8 LinearDumper (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper)8 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)6 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)5 RomClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker)5 J9ClassRegionNode (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode)4 ROMClassesIterator (com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator)3 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)3 RamClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker)3 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)2 ClassSummaryHelper (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassSummaryHelper)2 AbstractPointer (com.ibm.j9ddr.vm29.pointer.AbstractPointer)1 StructurePointer (com.ibm.j9ddr.vm29.pointer.StructurePointer)1 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)1 J9SharedCacheHeaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9SharedCacheHeaderPointer)1 J9SharedClassConfigPointer (com.ibm.j9ddr.vm29.pointer.generated.J9SharedClassConfigPointer)1 ParseException (java.text.ParseException)1 Stack (java.util.Stack)1