Examples of PFStatsNode


Examples of er.profiling.PFStatsNode

        // DO NOTHING
    }

    public void responseEnded(WOResponse response, WOContext context) {
        if (_heatEnabled) {
            PFStatsNode rootStats = PFProfiler.currentStats();
            if (rootStats != null) {
                response.appendContentString("<style>");
                appendHeatStyles(rootStats, response, context);
                response.appendContentString("</style>");
            }
View Full Code Here

Examples of er.profiling.PFStatsNode

        // DO NOTHING
    }

    public void responseEnded(WOResponse response, WOContext context) {
        if (_summaryEnabled) {
            PFStatsNode rootStats = PFProfiler.currentStats().rootStats();
            double total = rootStats.durationMillis();
            int sqlCount = rootStats.countOf("SQL", false);
            double sqlDuration = rootStats.durationOfMillis("SQL", false);
            double sqlDurationPercent = sqlDuration / total;
            int d2wCount = rootStats.countOf("D2W", false);
            double d2wDuration = rootStats.durationOfMillis("D2W", false);
            double d2wDurationPercent = d2wDuration / total;

            double takeValuesFromRequest = rootStats.durationOfMillis("takeValuesFromRequest", false) / total;
            double invokeAction = rootStats.durationOfMillis("invokeAction", false) / total;
            double appendToResponse = rootStats.durationOfMillis("appendToResponse", false) / total;

            String uuid = UUID.randomUUID().toString();
            PFProfiler.setStatsWithID(rootStats, uuid);

            StringBuilder profileString = new StringBuilder();
            profileString.append("Profiler: " + String.format("%.2f", total) + "ms; ");
            profileString.append("SQL: " + DecimalFormat.getPercentInstance().format(sqlDurationPercent) + " (" + sqlCount + "); ");
            profileString.append("D2W: " + DecimalFormat.getPercentInstance().format(d2wDurationPercent) + " (" + d2wCount + "); ");
            profileString.append("T/I/A: " + DecimalFormat.getPercentInstance().format(takeValuesFromRequest) + " / " + DecimalFormat.getPercentInstance().format(invokeAction)
                    + " / " + DecimalFormat.getPercentInstance().format(appendToResponse));
            System.out.println(profileString);

            response
                    .appendContentString("<div id=\"_profiler\" style=\"position: fixed; right: 0px; bottom: 0px; font-family: Helvetica; font-size: 9pt; font-weight:bold; white-space: no-wrap; clear: both; padding: 0.5em; padding-left: 10px; padding-right: 10px; background-color:rgba(240, 240, 255, 0.8); border: 1px solid rgb(200, 200, 215); border-bottom: none; border-right: none; border-top-left-radius: 10px\">");
            response.appendContentString("<span style=\"color:rgb(150,150,150)\">profiler:</span> " + String.format("%.2f", total) + "ms");

            Set<PFStatsNode> errorNodes = PFStatsChecker.checkForErrors(rootStats);
            if (!errorNodes.isEmpty()) {
                Set<String> errorTypes = new HashSet<String>();
                for (PFStatsNode errorNode : errorNodes) {
                    errorTypes.add(errorNode.name());
                }
                response.appendContentString("&nbsp;&nbsp;|&nbsp;&nbsp;");
                response.appendContentString("<font color=\"red\">profiler errors " + errorTypes + "</font>");
            }

            response.appendContentString("&nbsp;&nbsp;<span style=\"color:rgb(150,150,150)\">|</span>&nbsp;&nbsp;");
            PFStatsNode.DurationCount oneMS = rootStats.countBetweenDurations(0, 1000000);
            PFStatsNode.DurationCount tenMS = rootStats.countBetweenDurations(1000000, 10 * 1000000);
            PFStatsNode.DurationCount hundredMS = rootStats.countBetweenDurations(10 * 1000000, 100 * 1000000);
            PFStatsNode.DurationCount moreMS = rootStats.countBetweenDurations(100 * 1000000, Long.MAX_VALUE);

            float maxHeight = 20;
            response.appendContentString("<style>#pf_histogram .pf_histogram_details { display: none; } #pf_histogram:hover .pf_histogram_details { display: block; }</style>");
            response.appendContentString("<span id=\"pf_histogram\">");
            response.appendContentString("<span style=\"background-color:rgb(200,200,200);margin:0px;padding:0px;width:10px;display:inline-table;font-size:0pt;height:" + (maxHeight * oneMS.millis() / total) + "px;\">&nbsp;</span>");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.