Package org.apache.cocoon.profiling.statistics

Examples of org.apache.cocoon.profiling.statistics.Report


            List entries = new ArrayList(this.collector.getStatistics());
            Collections.sort(entries, new ReportComparator());
            final Iterator i = entries.iterator();
            while ( i.hasNext() ) {
                found = true;
                final Report report = (Report)i.next();
                final AttributesImpl attrs = new AttributesImpl();
                attrs.addCDATAAttribute("name", report.getCategory());
                XMLUtils.startElement(this.xmlConsumer, "report", attrs);
                XMLUtils.createElement(this.xmlConsumer, "count", String.valueOf(report.getCount()));
                XMLUtils.createElement(this.xmlConsumer, "min", this.getTime(report.getMin()));
                XMLUtils.createElement(this.xmlConsumer, "max", this.getTime(report.getMax()));
                XMLUtils.createElement(this.xmlConsumer, "last", this.getTime(report.getLast()));
                XMLUtils.createElement(this.xmlConsumer, "all", report.getAll());
                XMLUtils.createElement(this.xmlConsumer, "average", this.getTime(report.getAverage()));
                XMLUtils.endElement(this.xmlConsumer, "report");
            }
            if ( !found ) {
                XMLUtils.data(this.xmlConsumer, "No reports");               
            }
            XMLUtils.endElement(this.xmlConsumer, "reports");
            if ( found ) {
                XMLUtils.startElement(this.xmlConsumer, "pages");
                entries = new ArrayList(this.collector.getPageReports());
                Collections.sort(entries, new PageReportComparator());
                final Iterator pi = entries.iterator();
                while ( pi.hasNext() ) {
                    final PageReport report = (PageReport)pi.next();
                    final AttributesImpl attrs = new AttributesImpl();
                    attrs.addCDATAAttribute("id", report.getId());
                    attrs.addCDATAAttribute("date", report.getDate().toString());
                    XMLUtils.startElement(this.xmlConsumer, "report", attrs);
                    final Iterator si = report.getStatistics().iterator();
                    while ( si.hasNext() ) {
                        final Statistics stats = (Statistics)si.next();
                        attrs.clear();
                        attrs.addCDATAAttribute("name", stats.getCategory());
                        attrs.addCDATAAttribute("duraration", String.valueOf(stats.getDuration()));
View Full Code Here


    }

    public static final class ReportComparator implements Comparator {

        public int compare(Object o1, Object o2) {
            Report r1 = (Report)o1;
            Report r2 = (Report)o2;
            return r1.getCategory().compareTo(r2.getCategory());
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.profiling.statistics.Report

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.