protected int compareAverage(Aggregate one, Aggregate two) { if (one.getAverage() < two.getAverage()) { return descending ? 1 : -1; } else if (two.getAverage() < one.getAverage()) { return descending ? -1 : 1; } else { return 0; } }
public double getAverage() { return aggregate.getAverage(); }
private void writeTime(StringBuffer aBuffer, Aggregate aPoint, int depth) { aBuffer.append(timeFormatter.format(aPoint.getAverage())); aBuffer.append("<br />"); if (aPoint.hasChilds()) { Map childs = aPoint.getChilds(); int currentDepth = depth + 1; for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { Aggregate child = (Aggregate) iterator.next(); writeTime(aBuffer, child, currentDepth + 1); } } }
private void writeTime(StringBuffer aBuffer, Aggregate aPoint, int depth) { aBuffer.append(timeFormatter.format(aPoint.getAverage())); aBuffer.append("<br />"); if (aPoint.hasChilds()) { Map childs = aPoint.getChilds(); int currentDepth = depth + 1; for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { Aggregate child = (Aggregate) iterator.next(); writeTime(aBuffer, child, currentDepth + 1); } } }
public Object getAttribute(String string) throws AttributeNotFoundException, MBeanException, ReflectionException { if ("measurements".equals(string)) { return new Long(aggregate.getMeasurements()); } else if ("total".equals(string)) { return new Double(aggregate.getTotal()); } else if ("min".equals(string)) { return new Double(aggregate.getMin()); } else if ("max".equals(string)) { return new Double(aggregate.getMax()); } else if ("average".equals(string)) { return new Double(aggregate.getAverage()); } else { throw new AttributeNotFoundException(string); } }
public Object getAttribute(String string) throws AttributeNotFoundException, MBeanException, ReflectionException { if ("measurements".equals(string)) { return new Long(aggregate.getMeasurements()); } else if ("total".equals(string)) { return new Double(aggregate.getTotal()); } else if ("min".equals(string)) { return new Double(aggregate.getMin()); } else if ("max".equals(string)) { return new Double(aggregate.getMax()); } else if ("average".equals(string)) { return new Double(aggregate.getAverage()); } else { throw new AttributeNotFoundException(string); } }
private void writeAverage(StringBuffer aBuffer, Aggregate aPoint, int depth) { if (depth > 0) { aBuffer.append("<div class=\"childtime\" >"); } else { aBuffer.append("<div class=\"parenttime\" >"); } aBuffer.append(timeFormatter.format(aPoint.getAverage())); if (aPoint.hasChilds()) { Map childs = aPoint.getChilds(); int currentDepth = depth + 1; for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { Aggregate child = (Aggregate) iterator.next(); writeAverage(aBuffer, child, currentDepth + 1); } } aBuffer.append("</div>"); }
protected void writeAverage(Aggregate aPoint) throws IOException { response.write("<div class=\"parenttime\" >"); response.write(timeFormatter.format(aPoint.getAverage())); response.write("</div>"); }
public void render(Map points) { for (Iterator iterator = points.values().iterator(); iterator.hasNext();) { Aggregate aggregate = (Aggregate) iterator.next(); try { data.put(new CompositeDataSupport( tabularType.getRowType(), new String[]{"name", "measurements", "average", "min", "max", "total", "objectname"}, new Object[]{ aggregate.getName(), new Long(aggregate.getMeasurements()), new Double(aggregate.getAverage()), new Double(aggregate.getMin()), new Double(aggregate.getMax()), new Double(aggregate.getTotal()), calculateObjectName(measurementDomain, aggregate) })); } catch (Exception e) { throw new EtmException(e); } } } });
public void render(Map points) { for (Iterator iterator = points.values().iterator(); iterator.hasNext();) { Aggregate aggregate = (Aggregate) iterator.next(); try { data.put(new CompositeDataSupport( tabularType.getRowType(), new String[]{"name", "measurements", "average", "min", "max", "total", "objectname"}, new Object[]{ aggregate.getName(), new Long(aggregate.getMeasurements()), new Double(aggregate.getAverage()), new Double(aggregate.getMin()), new Double(aggregate.getMax()), new Double(aggregate.getTotal()), calculateObjectName(measurementDomain, aggregate) })); } catch (Exception e) { throw new EtmException(e); } } } });
public void addLine(int nestingLevel, Aggregate aAggregate) { nameColumn.addEntry(new NestedEntry(nestingLevel, aAggregate.getName())); numberColumn.addEntry(new RightAlignedEntry(String.valueOf(aAggregate.getMeasurements()))); avgColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getAverage()))); minColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getMin()))); maxColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getMax()))); totalColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getTotal()))); }
public void addLine(int nestingLevel, Aggregate aAggregate) { nameColumn.addEntry(new NestedEntry(nestingLevel, aAggregate.getName())); numberColumn.addEntry(new RightAlignedEntry(String.valueOf(aAggregate.getMeasurements()))); avgColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getAverage()))); minColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getMin()))); maxColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getMax()))); totalColumn.addEntry(new RightAlignedEntry(timeFormatter.format(aAggregate.getTotal()))); }
public void render(Map points) { assertTrue("No measurement result found.", !points.isEmpty()); Aggregate topLevelBar = ((Aggregate) points.get("BarService::doBar")); assertTrue(topLevelBar.getTotal() > 0); assertTrue(topLevelBar.getMin() > 0); assertTrue(topLevelBar.getMax() > 0); assertTrue(topLevelBar.getMin() < topLevelBar.getMax()); assertEquals(topLevelBar.getAverage() * topLevelBar.getMeasurements(), topLevelBar.getTotal(), 0.001d); assertEquals(MEASUREMENTS, topLevelBar.getMeasurements()); assertEquals(MEASUREMENTS, ((Aggregate) points.get("BarService::doBarBar")).getMeasurements()); assertEquals(MEASUREMENTS, ((Aggregate) points.get("FooService::doFoo")).getMeasurements()); assertEquals(MEASUREMENTS, ((Aggregate) points.get("FooService::doFooFoo")).getMeasurements()); Aggregate doYadda = ((Aggregate) points.get("YaddaService::doYadda")); assertEquals(MEASUREMENTS, doYadda.getMeasurements()); assertTrue(doYadda.hasChilds()); assertEquals(MEASUREMENTS * 2, ((Aggregate) doYadda.getChilds().get("BarService::doBar")).getMeasurements()); Aggregate doYaddaYadda = ((Aggregate) points.get("YaddaService::doYaddaYadda")); assertEquals(MEASUREMENTS, doYaddaYadda.getMeasurements()); assertTrue(doYaddaYadda.hasChilds()); Aggregate doBar = ((Aggregate) doYaddaYadda.getChilds().get("BarService::doBar")); assertEquals(MEASUREMENTS * 2, doBar.getMeasurements()); assertTrue(doBar.hasChilds()); assertEquals(MEASUREMENTS * 2, ((Aggregate) doBar.getChilds().get("FooService::doFoo")).getMeasurements()); Aggregate doBarBar = ((Aggregate) doYaddaYadda.getChilds().get("BarService::doBarBar")); assertEquals(MEASUREMENTS, doBarBar.getMeasurements()); assertTrue(doBarBar.hasChilds()); assertEquals(MEASUREMENTS, ((Aggregate) doBarBar.getChilds().get("FooService::doFoo")).getMeasurements()); assertEquals(MEASUREMENTS, ((Aggregate) doBarBar.getChilds().get("FooService::doFooFoo")).getMeasurements()); } });