Search in sources :

Example 1 with IJavaRuntimeBuilder

use of com.ibm.dtfj.javacore.builder.IJavaRuntimeBuilder in project openj9 by eclipse.

the class NativeMemorySectionParser method topLevelRule.

protected void topLevelRule() throws ParserException {
    IImageProcessBuilder fImageProcessBuilder = fImageBuilder.getCurrentAddressSpaceBuilder().getCurrentImageProcessBuilder();
    IJavaRuntimeBuilder fRuntimeBuilder = fImageProcessBuilder.getCurrentJavaRuntimeBuilder();
    IAttributeValueMap results = null;
    Stack categoryStack = new Stack();
    processTagLineOptional(T_0MEMUSER);
    while ((results = processMemUserLine()) != null) {
        String name = results.getTokenValue(A_NAME);
        /* If no name available, this is a spacing line */
        if (name == null) {
            continue;
        }
        int depth = results.getIntValue(A_DEPTH);
        while (categoryStack.size() >= depth) {
            categoryStack.pop();
        }
        long deepBytes = parseCommaDelimitedLong(results.getTokenValue(A_DEEP_BYTES));
        long deepAllocations = parseCommaDelimitedLong(results.getTokenValue(A_DEEP_ALLOCATIONS));
        JavaRuntimeMemoryCategory parent = null;
        if (categoryStack.size() > 0) {
            parent = (JavaRuntimeMemoryCategory) categoryStack.peek();
        }
        if (name.equals(OTHER_CATEGORY)) {
            if (parent == null) {
                throw new ParserException("Parse error: Unexpected NULL parent category for \"Other\" memory category");
            }
            fRuntimeBuilder.setShallowCountersForCategory(parent, deepBytes, deepAllocations);
        } else {
            JavaRuntimeMemoryCategory category = fRuntimeBuilder.addMemoryCategory(name, deepBytes, deepAllocations, parent);
            categoryStack.push(category);
        }
    }
}
Also used : ParserException(com.ibm.dtfj.javacore.parser.framework.parser.ParserException) IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) JavaRuntimeMemoryCategory(com.ibm.dtfj.java.JavaRuntimeMemoryCategory) IJavaRuntimeBuilder(com.ibm.dtfj.javacore.builder.IJavaRuntimeBuilder) IImageProcessBuilder(com.ibm.dtfj.javacore.builder.IImageProcessBuilder) Stack(java.util.Stack)

Aggregations

JavaRuntimeMemoryCategory (com.ibm.dtfj.java.JavaRuntimeMemoryCategory)1 IImageProcessBuilder (com.ibm.dtfj.javacore.builder.IImageProcessBuilder)1 IJavaRuntimeBuilder (com.ibm.dtfj.javacore.builder.IJavaRuntimeBuilder)1 ParserException (com.ibm.dtfj.javacore.parser.framework.parser.ParserException)1 IAttributeValueMap (com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)1 Stack (java.util.Stack)1