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 writeMeasurements(StringBuffer aBuffer, Aggregate aPoint, int depth) { aBuffer.append(aPoint.getMeasurements()); 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(); writeMeasurements(aBuffer, child, currentDepth); } } }
private void writeNames(StringBuffer aBuffer, Aggregate aPoint, int depth) { if (depth > 0) { writeNestingLevel(aBuffer, depth); aBuffer.append(TREE_SIGN); } aBuffer.append(aPoint.getName()); aBuffer.append("<br />"); if (aPoint.hasChilds()) { int currentDepth = depth + 1; Map childs = aPoint.getChilds(); for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { Aggregate child = (Aggregate) iterator.next(); writeNames(aBuffer, child, currentDepth); } } }
public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (value != null && value instanceof AggregationNode) { Aggregate aggregate = (Aggregate) ((AggregationNode) value).getUserObject(); return aggregate.getName() + " [" + aggregate.getMeasurements() + "]"; } return ""; }
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()); } });
private void writeMinMax(StringBuffer aBuffer, Aggregate aPoint, int depth) { aBuffer.append(timeFormatter.format(aPoint.getMin())); aBuffer.append("/"); aBuffer.append(timeFormatter.format(aPoint.getMax())); 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(); writeMinMax(aBuffer, child, currentDepth + 1); } } }
private void writeTotals(StringBuffer aBuffer, Aggregate aPoint, int depth) { aBuffer.append(timeFormatter.format(aPoint.getTotal())); 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(); writeTotals(aBuffer, child, currentDepth); } } }
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 SortedExecutionGraph(Aggregate aAggregate, ExecutionAggregateComparator aComparator) { aggregate = aAggregate; if (aAggregate.hasChilds()) { Map childs = aAggregate.getChilds(); sortedChilds = new ArrayList(); for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { SortedExecutionGraph child = new SortedExecutionGraph((Aggregate) iterator.next(), aComparator); sortedChilds.add(child); } Collections.sort(sortedChilds, aComparator); } }
public String getName() { return aggregate.getName(); }
private void writeMin(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.getMin())); if (aPoint.hasChilds()) { Map childs = aPoint.getChilds(); int currentDepth = depth + 1; for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { Aggregate child = (Aggregate) iterator.next(); writeMin(aBuffer, child, currentDepth + 1); } } aBuffer.append("</div>"); }
private void writeMax(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.getMax())); if (aPoint.hasChilds()) { Map childs = aPoint.getChilds(); int currentDepth = depth + 1; for (Iterator iterator = childs.values().iterator(); iterator.hasNext();) { Aggregate child = (Aggregate) iterator.next(); writeMax(aBuffer, child, currentDepth + 1); } } aBuffer.append("</div>"); }
public void render(Map points) { String key = "SoapAction ASoapRequest"; assertTrue(points.containsKey(key)); Aggregate aggregate = (Aggregate) points.get(key); assertEquals(1, aggregate.getMeasurements()); assertEquals(15d, aggregate.getMin(), 0); } });
protected int compareExecutions(Aggregate one, Aggregate two) { if (one.getMeasurements() < two.getMeasurements()) { return descending ? 1 : -1; } else if (two.getMeasurements() < one.getMeasurements()) { return descending ? -1 : 1; } else { return 0; } }
public Map getChilds() { return aggregate.getChilds(); }
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; } }
private void writeMinMax(StringBuffer aBuffer, Aggregate aPoint, int depth) { aBuffer.append(timeFormatter.format(aPoint.getMin())); aBuffer.append("/"); aBuffer.append(timeFormatter.format(aPoint.getMax())); 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(); writeMinMax(aBuffer, child, currentDepth + 1); } } }