Package org.netbeans.lib.profiler.results.cpu

Examples of org.netbeans.lib.profiler.results.cpu.PrestimeCPUCCTNode


        }
        if ((nodes == null) || nodes.length == 0) {
            return false;
        }
        for (CCTNode cCTNode : nodes) {
            PrestimeCPUCCTNode pCCTNode = (PrestimeCPUCCTNode) cCTNode;
            if (pCCTNode.isSelfTimeNode()) {
                continue;
            } else if (containsMethod(pCCTNode, methodName)){
                return true;
            }
        }
View Full Code Here


        }
        SuspiciousMethodMapping mapping = SuspiciousMethodMapping.getMappingFor(em, candidate.getMethodName());
        if (mapping == null){
            return candidate;
        }
        PrestimeCPUCCTNode maxOccurence = findLongestOccurenceOutsideAWT(mapping.getMappedMethodName());
        if (maxOccurence == null){
            return candidate;
        }
        MethodItem newCandidate = getSuspiciousMethodItemFromRoot(em, maxOccurence);
        if (newCandidate == null){
View Full Code Here

        final List<MethodItem> suspiciousStackPrefix = new ArrayList<MethodItem>();
        final Matcher matcher = Matcher.getDefault();
        Utils.processPersistable(new Persistable.Query() {

            public TransactionResult runQuery(EntityManager em) throws Exception {
                PrestimeCPUCCTNode node = getBiggestChild(root);
                Component componentCandidate = null;
                long selfTime;
                boolean canContinue = true;
                do {
                    selfTime = getSelfTime(node);
                    String methodName = getMethodName(node);
                    suspiciousStackPrefix.add(new MethodItem(methodName, node.getTotalTime0(), selfTime));
                    Component nodeComponent = matcher.matchMethod(em, node.getNodeName());
                    if (nodeComponent != null) {
                        componentCandidate = nodeComponent;// find deepest known component
                    }
                    if (isMoreThan(selfTime, PERCENTAGE_OF_SELF_NODE, node.getTotalTime0())) {
                        if (nodeComponent != null) {
                            canContinue = false;
                        }
                    }
                    PrestimeCPUCCTNode child = getBiggestChild(node);
                    if (child == null) {
                        canContinue = false;
                    } else if (!isMoreThan(child.getTotalTime0(), PERCENTAGE_OF_BIGGEST_NODE, node.getTotalTime0())) {
                        if (componentCandidate != null) {
                            canContinue = false;
                        }
                    }
                    node = child;
View Full Code Here

    private PrestimeCPUCCTNode getBiggestChild(PrestimeCPUCCTNode node) {
        CCTNode[] nodes = node.getChildren();
        if ((nodes == null) || nodes.length == 0) {
            return null;
        }
        PrestimeCPUCCTNode biggestChild = null;
        for (CCTNode cCTNode : nodes) {
            PrestimeCPUCCTNode pCCTNode = (PrestimeCPUCCTNode) cCTNode;
            if (pCCTNode.isSelfTimeNode()) {
                continue;
            } else if ((biggestChild == null) || (biggestChild.getTotalTime0() < pCCTNode.getTotalTime0())) {
                biggestChild = pCCTNode;
            }
        }
        return biggestChild;
    }
View Full Code Here

    private long getSelfTime(PrestimeCPUCCTNode node) {
        if (node.getChildren() == null) {
            return node.getTotalTime0();
        }
        assert node.getChildren().length > 1;
        PrestimeCPUCCTNode firstNode = (PrestimeCPUCCTNode) node.getChild(0);
        assert "Self time:".equals(firstNode.getNodeName());
        assert firstNode.isSelfTimeNode();
        return firstNode.getTotalTime0();
    }
View Full Code Here

        writer.println(node.getNodeName() + ": " + toMS(node.getTotalTime0()) + " / " + toMS(getSelfTime(node)));
        long parentTime = node.getTotalTime0();
        CCTNode[] children = node.getChildren();
        if (children != null) {
            for (CCTNode child : children) {
                PrestimeCPUCCTNode childNode = (PrestimeCPUCCTNode) child;
                if (parentTime != childNode.getTotalTime0()) {
                    dumpCCTNode(depth + 1, writer, offset + 1, childNode);
                } else {
                    dumpCCTNode(depth + 1, writer, offset, childNode);
                }
            }
View Full Code Here

    private int toMS(long l) {
        return new Long(l / 1000).intValue();
    }

    private PrestimeCPUCCTNode findLongestOccurenceOutsideAWT(String mappedMethodName) {
        PrestimeCPUCCTNode bestOccurence  = null;
        for (int threadId :  snapshot.getThreadIds()) {
            String name = snapshot.getThreadNameForId(threadId);
            if (name.contains("AWT-EventQueue")) {
                // skip AWT thread
                continue;
            }
            CPUCCTContainer cont = snapshot.getContainerForThread(threadId, CPUResultsSnapshot.METHOD_LEVEL_VIEW);
            PrestimeCPUCCTNode occurence = getMaxOccurence(cont.getRootNode(), mappedMethodName);
            if (bestOccurence == null){
                bestOccurence = occurence;
            }else if (occurence != null){
                bestOccurence = bestOccurence.getTotalTime0() > occurence.getTotalTime0() ? bestOccurence : occurence;
            }
        }
        return bestOccurence;
    }
View Full Code Here

            return null;
        }
        if (node.getNodeName().contains(methodName)) {
            return node;
        }
        PrestimeCPUCCTNode bestOccurence  = null;
        CCTNode[] children =node.getChildren();
        if (children == null){
            return null;
        }
        for (CCTNode child : children) {
            PrestimeCPUCCTNode occurence = getMaxOccurence((PrestimeCPUCCTNode) child, methodName);
            if (bestOccurence == null){
                bestOccurence = occurence;
            }else if (occurence != null){
                bestOccurence = bestOccurence.getTotalTime0() > occurence.getTotalTime0() ? bestOccurence : occurence;
            }
        }
        return bestOccurence;
    }
View Full Code Here

TOP

Related Classes of org.netbeans.lib.profiler.results.cpu.PrestimeCPUCCTNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.