Package org.jboss.profiler.model

Examples of org.jboss.profiler.model.JBPMethod


        try {
            response.setContentType(CONTENT_TYPE);
            response.setHeader("pragma", "no-cache");

            Integer methodId = new Integer(request.getParameter("methodId"));
            JBPMethod keyMethod = new JBPMethod();
            keyMethod.setMethodID(methodId.intValue());

            javax.servlet.http.HttpSession session = request.getSession();

            org.jboss.profiler.web.form.FilterForm beanFilter = (org.jboss.profiler.web.form.FilterForm) request
                    .getSession().getAttribute("filterForm");

            org.jboss.profiler.model.JBPProcess spyProcess = beanFilter
                    .getJbpProcess();

            Integer threadId = null;
            JBPThread thread = null;

            if (request.getParameter("threadId") != null) {
                JBPThread threadKey = new JBPThread();
                threadId = new Integer(request.getParameter("threadId"));
                threadKey.setThreadId(threadId.intValue());
                thread = (JBPThread) spyProcess.getSpyThreads().get(threadKey);
            }

            HashMap spyMethods = spyProcess.getSpyMethods();
            JBPMethod spyMethodProcess = (JBPMethod) spyMethods.get(keyMethod);

            JBPMethodCount consolidacao = (JBPMethodCount) request.getSession()
                    .getAttribute("consolidacaoMetodo");
            if (thread == null
                    && (consolidacao == null
                            || consolidacao.getSpyMethod().equals(
                                    spyMethodProcess) || session
                            .getAttribute("consolidacaoThread") != null)) {
                consolidacao = spyProcess.consolidaCallings(spyMethodProcess);
                session.setAttribute("consolidacaoMetodo", consolidacao);
                session.removeAttribute("consolidacaoThread");
            } else {
                JBPThread consolidacaoThread = (JBPThread) session
                        .getAttribute("consolidacaoThread");
                if (thread != null
                        && (consolidacao == null
                                || consolidacaoThread == null
                                || consolidacaoThread.getThreadId() != threadId
                                        .intValue() || !consolidacao
                                .getSpyMethod().equals(spyMethodProcess))) {
                    consolidacao = thread.consolidaCallings(spyMethodProcess);
                    session.setAttribute("consolidacaoMetodo", consolidacao);
                    session.setAttribute("consolidacaoThread", thread);
                }
            }

            // qual instancia sera utilizada no calculo
            JBPMethod spyMethodToCalc = spyMethodProcess;
            if (thread != null) {
                spyMethodToCalc = (JBPMethod) thread.getSpyMethods().get(
                        spyMethodToCalc);
            }

            int numberOfPaths = 0;
            if (request.getParameter("npath") != null) {
                numberOfPaths = Integer.parseInt(request.getParameter("npath"));
            }

            int methodsId[] = new int[numberOfPaths];
            JBPMethod metodosPesquisados[] = new JBPMethod[numberOfPaths];

            String urlBasesrc = "methodId=" + methodId; // url para seguir o
                                                        // caminho
            if (thread != null) {
                urlBasesrc += "&threadId=" + threadId;
View Full Code Here


        url.append("?methodId=" + root.getMethodID());
        int pathLength = 0;
        if (path != null)
            pathLength = path.size();
        for (int i = 0; i < pathLength; i++) {
            JBPMethod spyMethod = (JBPMethod) path.get(i);
            url.append("&m" + i + "=" + spyMethod.getMethodID());
        }
        if (currentMethod != null) {
            pathLength += 1;
            url.append("&m" + (pathLength - 1) + "="
                    + currentMethod.getMethodID());
View Full Code Here

            }

            stack.push(path[i]);
        }

        JBPMethod methodConsolidado = consolidacao.getSpyMethod();
        methodConsolidado = (JBPMethod) spyMethods.get(methodConsolidado);

        generateCallingsRecursive(level, oldMethod, rootMethod, consolidacao,
                hashMethods, hashCallings, referenceKey, stack);
View Full Code Here

    throws ServletException, IOException {
    try {
      response.setContentType(CONTENT_TYPE);
      response.setHeader("pragma", "no-cache");

      JBPMethod keyMethod = new JBPMethod();
      JBPClass keyClass = new JBPClass();

      javax.servlet.http.HttpSession session = request.getSession();

      org.jboss.profiler.web.form.FilterForm beanFilter =
        (org.jboss.profiler.web.form.FilterForm) request
          .getSession()
          .getAttribute("filterForm");

      org.jboss.profiler.model.JBPProcess spyProcess =
        beanFilter.getJbpProcess();

      int classId = Integer.parseInt(request.getParameter("classId"));
      keyClass.setClassID(classId);
      JBPClass spyClass =
        (JBPClass) spyProcess.getSpyClasses().get(keyClass);

      HashMap spyMethods = spyProcess.getSpyMethods();
      JBPMethod spyMethodProcess = (JBPMethod) spyMethods.get(keyMethod);

      Collection listMethods = null;
      if (request.getSession().getAttribute("instancesStack.class")
        == null
        || !(
          (JBPClass) session.getAttribute(
            "instancesStack.class")).equals(
          spyClass)) {
        session.setAttribute("instancesStack.class", spyClass);
        listMethods = spyProcess.findMemoryLeaks(spyClass);
        session.setAttribute("listMethodsLeaks", listMethods);
      } else {
        listMethods =
          (Collection) session.getAttribute("listMethodsLeaks");
      }

      boolean viewCreation = false;
      if (request.getParameter("viewCreation") != null)
        viewCreation = true;

      int pathSize = 0;
      if (request.getParameter("pathSize") != null)
        pathSize = Integer.parseInt(request.getParameter("pathSize"));

      int methodsId[] = new int[pathSize];
      JBPMethod metodosPesquisados[] = new JBPMethod[pathSize];

      JBPMethodCount rootCount = null;
      JBPMethodCount consolidacao = null;

      String urlBasesrc = "classId=" + classId;
View Full Code Here

    long oldMethod = 0;

    int level = 0;
    // root

    JBPMethod methodConsolidado = consolidacao.getSpyMethod();

    generateCallingsRecursive(
      baseUrl,
      pathSize,
      level,
View Full Code Here

    int pathLength = basicPathLength;
    if (path != null)
      pathLength = path.size();

    for (int i = 0; i < pathLength; i++) {
      JBPMethod spyMethod = (JBPMethod) path.get(i);
      url.append(
        "&m" + (i + basicPathLength) + "=" + spyMethod.getMethodID());
    }

    if (currentMethod != null) {
      pathLength += 1;
      url.append(
View Full Code Here

        HashMap roots = spyProcess.consolidateRoots();
        Iterator iterRoots = roots.values().iterator();

        while (iterRoots.hasNext()) {
            JBPGenericCount rootInstance = (JBPGenericCount) iterRoots.next();
            JBPMethod methodOnProcess = (JBPMethod) spyProcess.getSpyMethods()
                    .get(rootInstance.getReferencedObject());
            JBPGenericCount rootConsolidado = spyProcess
                    .consolidaCallings(methodOnProcess);
            setRoots.add(rootConsolidado);
        }
View Full Code Here

    private static ArrayList aggregateMethods(JBPProcess process, JBPClass jbpClass) {
        ArrayList listCounts = new ArrayList();

        Iterator iterMethods = jbpClass.getSpyMethods().values().iterator();
        while (iterMethods.hasNext()) {
            JBPMethod method = (JBPMethod)iterMethods.next();
            JBPGenericCount consolidation = process.consolidaCallings(method);
            listCounts.add(consolidation);
        }
        return listCounts;
    }
View Full Code Here

    /** @return True if the method have the percentage ok */
    private static boolean openMethod(double minPercentage, int level,
            PrintStream out, JBPMethodCount count, JBPMethodCount rootMethod,
            JBPProcess process, boolean isRoot,
            java.text.NumberFormat numberFormat) {
        JBPMethod methodOnProcess = (JBPMethod) process.getSpyMethods().get(
                count.getSpyMethod());
        double totalClocks = 0, totalTime = 0;
        if (isRoot) {
            totalClocks = process.getTotalClocks();
            totalTime = process.getTotalElapsedClocks();
        } else {
            totalClocks = rootMethod.getTotalClocks();
            totalTime = rootMethod.getTotalElapsedClock();
        }

        double cpuPercentValue = 0.0;

        double timePercentValue = 0.0;

        /*
         * if (isRoot) { cpuPercentValue =
         * (((double)methodOnProcess.getTotalClock()) / totalClocks) *
         * (double)100; timePercentValue =
         * (((double)methodOnProcess.getTotalElapsedClock()) / totalTime) *
         * (double)100; } else { cpuPercentValue =
         * (((double)count.getTotalClocks()) / totalClocks) * (double)100;
         * timePercentValue = (((double)count.getTotalElapsedClock()) /
         * totalTime) * (double)100; } -- trecho desabilitado, depois que
         * mudamos a rotina para enviar apenas consolidacoes
         */

        cpuPercentValue = (((double) count.getTotalClocks()) / totalClocks)
                * (double) 100;
        timePercentValue = (((double) count.getTotalElapsedClock()) / totalTime)
                * (double) 100;

        String cpuPercentual = numberFormat.format(cpuPercentValue);
        String timePercentual = numberFormat.format(timePercentValue);

        if (minPercentage <= 0 || cpuPercentValue > minPercentage
                || timePercentValue > minPercentage) {
            for (int i = 0; i < level; i++) {
                out.print(IDENT_ON_LEVEL);
            }

            out.print("<method name=\"" + myEncode1(methodOnProcess.getName())
                    + "\"");
            out.print(" cpuPercenptual=\"" + cpuPercentual + "\"");
            out.print(" timePercenptual=\"" + timePercentual + "\"");
            out.print(" fullName=\"" + myEncode2(methodOnProcess.getFullName())
                    + "\"");
            out.println(">");

            return true;
        } else {
View Full Code Here

                continue;
            }
            Iterator methods = jbpClass.getSpyMethods().values().iterator();
            int count=0;
            while (methods.hasNext()) {
                JBPMethod jbpMethod = (JBPMethod)methods.next();

                GraphCallings graph = GraphGenerator.generateCallings(standalone.getEngine().getProcess(),jbpMethod);
                if (graph.getMethods().size()==0) {
                    continue;
                }

                ExecutionInfoSummary summary = prepareSummary(jbpMethod,pid);

                String basicFileName = baseFileName + classesArray[clazzCount]+"_method_" + (count++);
                summary.addGraphFile(basicFileName + ".html");
                String fileName = outputDir + basicFileName;


                ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(fileName + ".obj")));
                out.writeObject(graph);
                out.close();

                PrintStream printOut = new PrintStream(new BufferedOutputStream(new FileOutputStream(fileName+".html")));
                printOut.println("<html>");
                printOut.println("<body>");
                printOut.println("<br>Graph of " + jbpMethod.getFullName());
                printOut.println("<APPLET CODE=\"org.jboss.profiler.graphapplet.GraphApplet\" WIDTH=800 HEIGHT=600 ");
                printOut.println("ARCHIVE=\"graphApplet.jar\">");
                printOut.println("<param name = \"url\" value=\"./" + basicFileName + ".obj\">");
          printOut.println("</APPLET>");
            printOut.println("</body>");
View Full Code Here

TOP

Related Classes of org.jboss.profiler.model.JBPMethod

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.