private ExecutionAggregate getChild(String aName) { if (childs == null) { childs = new HashMap(); } ExecutionAggregate aggregate = (ExecutionAggregate) childs.get(aName); if (aggregate == null) { aggregate = new ExecutionAggregate(aName); childs.put(aName, aggregate); } return aggregate; }
/** * Append a measurement result from the end of a tree. * * @param newTree The tree to the measurement result. */ public void appendPath(LinkedList newTree) { EtmPoint current = (EtmPoint) newTree.removeFirst(); ExecutionAggregate aggregate = getChild(current.getName()); if (newTree.size() == 0) { aggregate.addTransaction(current); } else { aggregate.appendPath(newTree); } }
assertEquals(testPointGroup1, aggregate.getName()); assertEquals(testSize * iterations, aggregate.getMeasurements()); assertEquals(group1.getTotal(), aggregate.getTotal(), 0.000001); assertEquals(group1.getMin(), aggregate.getMin(), 0.000001); assertEquals(group1.getMax(), aggregate.getMax(), 0.000001); assertTrue(aggregate.hasChilds()); Map childs1 = aggregate.getChilds(); Aggregate aggregateChild1 = (Aggregate) childs1.get("nested" + testPointGroup1); assertEquals(nested1.getName(), aggregateChild1.getName()); assertEquals(testSize * iterations, aggregateChild1.getMeasurements()); assertEquals(nested1.getTotal(), aggregateChild1.getTotal(), 0.000001); assertEquals(nested1.getMin(), aggregateChild1.getMin(), 0.000001); assertEquals(nested1.getMax(), aggregateChild1.getMax(), 0.000001); assertEquals(testPointGroup2, aggregate2.getName()); assertEquals(testSize * iterations, aggregate2.getMeasurements()); assertEquals(group2.getTotal(), aggregate2.getTotal(), 0.000001); assertEquals(group2.getMin(), aggregate2.getMin(), 0.000001); assertEquals(group2.getMax(), aggregate2.getMax(), 0.000001); assertTrue(aggregate2.hasChilds()); Map childs2 = aggregate2.getChilds();
public void add(EtmPoint point) { LinkedList path = new LinkedList(); path.add(point.getName()); EtmPoint parent = point.getParent(); while (parent != null) { path.addFirst(parent.getName()); parent = parent.getParent(); } DefaultMutableTreeNode node = (DefaultMutableTreeNode) getRoot(); while (!path.isEmpty()) { String currentString = (String) path.removeFirst(); Enumeration childs = node.children(); DefaultMutableTreeNode currentChild = null; while (currentChild == null && childs.hasMoreElements()) { DefaultMutableTreeNode measurementNode = (DefaultMutableTreeNode) childs.nextElement(); Aggregate aggregate = (Aggregate) measurementNode.getUserObject(); if (aggregate.getName().equals(currentString)) { currentChild = measurementNode; } } if (currentChild == null) { currentChild = new DefaultMutableTreeNode(new ExecutionAggregate(currentString)); insertNodeInto(currentChild, node, getChildCount(currentChild)); } node = currentChild; } ((ExecutionAggregate) node.getUserObject()).addTransaction(point); nodeChanged(node); delegate.add(point); }
public void render(Map points) { assertEquals(expectedExecutions, new TestHelper().countExecutions(points)); assertNotNull(points); assertTrue(points.size() == 1); Aggregate aggregate = (Aggregate) points.get(testPointGroup1); assertNotNull(aggregate); assertEquals(testPointGroup1, aggregate.getName()); assertEquals(group1.getMeasurements(), aggregate.getMeasurements()); assertEquals(group1.getTotal(), aggregate.getTotal(), 0.0001); assertEquals(group1.getMin(), aggregate.getMin(), 0.0001); assertEquals(group1.getMax(), aggregate.getMax(), 0.0001); } });
public void add(EtmPoint point) { // shortcut for parent == null; if (point.getParent() == null) { ExecutionAggregate aggregate = getAggregate(point.getName()); aggregate.addTransaction(point); return; } // TODO check alternative strategy to improve performance // find tree root node LinkedList path = new LinkedList(); path.add(point); EtmPoint rootNode = point.getParent(); while (rootNode != null) { path.addFirst(rootNode); rootNode = rootNode.getParent(); } rootNode = (EtmPoint) path.removeFirst(); ExecutionAggregate aggregate = getAggregate(rootNode.getName()); aggregate.appendPath(path); }
public void render(Map points) { assertNotNull(points); assertTrue(points.size() == 2); int expectedExecutions = 2 * testSize * iterations; assertEquals(expectedExecutions, new TestHelper().countExecutions(points)); Aggregate aggregate = (Aggregate) points.get(testPointGroup1); assertNotNull(aggregate); assertEquals(testPointGroup1, aggregate.getName()); assertEquals(testSize * iterations, aggregate.getMeasurements()); assertEquals(group1.getTotal(), aggregate.getTotal(), 0.000001); assertEquals(group1.getMin(), aggregate.getMin(), 0.000001); assertEquals(group1.getMax(), aggregate.getMax(), 0.000001); Aggregate aggregate2 = (Aggregate) points.get(testPointGroup2); assertNotNull(aggregate2); assertEquals(testPointGroup2, aggregate2.getName()); assertEquals(testSize * iterations, aggregate2.getMeasurements()); assertEquals(group2.getTotal(), aggregate2.getTotal(), 0.000001); assertEquals(group2.getMin(), aggregate2.getMin(), 0.000001); assertEquals(group2.getMax(), aggregate2.getMax(), 0.000001); } });
public void add(EtmPoint point) { ExecutionAggregate aggregate = getAggregate(point.getName()); aggregate.addTransaction(point); }
public void add(EtmPoint point) { // short cut for parent == null; if (point.getParent() == null) { super.add(point); return; } // TODO check alternative strategy to improve performance // find tree root node LinkedList path = new LinkedList(); path.add(point); EtmPoint rootNode = point.getParent(); while (rootNode != null) { path.addFirst(rootNode); rootNode = rootNode.getParent(); } rootNode = (EtmPoint) path.removeFirst(); ExecutionAggregate aggregate = getAggregate(rootNode.getName()); aggregate.appendPath(path); }
private void analyzeNested(Map aggregationPoints, EtmPoint[] aEtmPoints, int i) { EtmPoint current = aEtmPoints[i - 1]; ExecutionAggregate aggregate = (ExecutionAggregate) aggregationPoints.get(current.getName()); assertNotNull(aggregate); assertEquals(current.getName(), aggregate.getName()); assertEquals(1, aggregate.getMeasurements()); assertEquals(current.getTransactionTime(), aggregate.getTotal(), 0.0); assertEquals(current.getTransactionTime(), aggregate.getMin(), 0.0); assertEquals(current.getTransactionTime(), aggregate.getMax(), 0.0); i--; if (i != 0) { assertTrue(aggregate.hasChilds()); analyzeNested(aggregate.getChilds(), aEtmPoints, i); } }
final ExecutionAggregate group1 = new ExecutionAggregate(testPointGroup1); final ExecutionAggregate group2 = new ExecutionAggregate(testPointGroup2); group1.addTransaction(point); } else { group2.addTransaction(point);
public void add(EtmPoint point) { // shortcut for parent == null; if (point.getParent() == null) { ExecutionAggregate aggregate = getAggregate(point.getName()); aggregate.addTransaction(point); return; } // TODO check alternative strategy to improve performance // find tree root node LinkedList path = new LinkedList(); path.add(point); EtmPoint rootNode = point.getParent(); while (rootNode != null) { path.addFirst(rootNode); rootNode = rootNode.getParent(); } rootNode = (EtmPoint) path.removeFirst(); ExecutionAggregate aggregate = getAggregate(rootNode.getName()); aggregate.appendPath(path); }
public void add(EtmPoint point) { ExecutionAggregate aggregate = getAggregate(point.getName()); aggregate.addTransaction(point); }
public void add(EtmPoint point) { // short cut for parent == null; if (point.getParent() == null) { super.add(point); return; } // TODO check alternative strategy to improve performance // find tree root node LinkedList path = new LinkedList(); path.add(point); EtmPoint rootNode = point.getParent(); while (rootNode != null) { path.addFirst(rootNode); rootNode = rootNode.getParent(); } rootNode = (EtmPoint) path.removeFirst(); ExecutionAggregate aggregate = getAggregate(rootNode.getName()); aggregate.appendPath(path); }
public void render(Map points) { assertNotNull(points); assertTrue(points.size() == 1); assertEquals(2, new TestHelper().countExecutions(points)); // analyze point one ExecutionAggregate aggregate = (ExecutionAggregate) points.get("test"); assertNotNull(aggregate); assertEquals("test", aggregate.getName()); assertEquals(1, aggregate.getMeasurements()); assertEquals(point.getTransactionTime(), aggregate.getTotal(), 0.0); assertEquals(point.getTransactionTime(), aggregate.getMin(), 0.0); assertEquals(point.getTransactionTime(), aggregate.getMax(), 0.0); // check nested point assertTrue(aggregate.hasChilds()); Map childs = aggregate.getChilds(); assertEquals(1, childs.size()); Aggregate aggregate2 = (Aggregate) childs.get("test2"); assertNotNull(aggregate2); assertEquals("test2", aggregate2.getName()); assertEquals(1, aggregate2.getMeasurements()); assertEquals(point2.getTransactionTime(), aggregate2.getTotal(), 0.0); assertEquals(point2.getTransactionTime(), aggregate2.getMin(), 0.0); assertEquals(point2.getTransactionTime(), aggregate2.getMax(), 0.0); } });
aggregate = new ExecutionAggregate(point.getName()); aggregates.put(point.getName(), aggregate); aggregate.addTransaction(point);
/** * Append a measurement result from the end of a tree. * * @param newTree The tree to the measurement result. */ public void appendPath(LinkedList newTree) { EtmPoint current = (EtmPoint) newTree.removeFirst(); ExecutionAggregate aggregate = getChild(current.getName()); if (newTree.isEmpty()) { aggregate.addTransaction(current); } else { aggregate.appendPath(newTree); } }
private ExecutionAggregate getChild(String aName) { if (childs == null) { childs = new HashMap(); } ExecutionAggregate aggregate = (ExecutionAggregate) childs.get(aName); if (aggregate == null) { aggregate = new ExecutionAggregate(aName); childs.put(aName, aggregate); } return aggregate; }
assertEquals("test", aggregate.getName()); assertEquals(2, aggregate.getMeasurements()); assertEquals(point.getTransactionTime() + pointNew.getTransactionTime(), aggregate.getTotal(), 0.0); assertEquals(pointNew.getTransactionTime(), aggregate.getMin(), 0.0); assertEquals(point.getTransactionTime(), aggregate.getMax(), 0.0); assertTrue(aggregate.hasChilds()); Map childs = aggregate.getChilds(); assertEquals("test-nest10", aggregate10.getName()); assertEquals(2, aggregate10.getMeasurements()); assertTrue(aggregate10.hasChilds()); Map childs20 = aggregate10.getChilds();
final ExecutionAggregate group1 = new ExecutionAggregate(testPointGroup1); final ExecutionAggregate group2 = new ExecutionAggregate(testPointGroup2); final ExecutionAggregate nested1 = new ExecutionAggregate("nested" + testPointGroup1); final ExecutionAggregate nested2 = new ExecutionAggregate("nested" + testPointGroup2); group1.addTransaction(point); } else if (point.getName().equals(testPointGroup2)) { group2.addTransaction(point); } else if (point.getName().equals("nested" + testPointGroup1)) { nested1.addTransaction(point); } else if (point.getName().equals("nested" + testPointGroup2)) { nested2.addTransaction(point); } else { fail("Unknown point " + point.getName());