/** * @return a nicely-formatted list of all the events invoked after the one under * measurement (including that one as the first element) */ String getForwardTrace() { if (children.isEmpty()) { return stackTraceElement(); } else if (children.size() == 1) { return stackTraceElement() + "/" + children.get(0).getForwardTrace(); } else { // Handles the 'freak case' where one event may forward directly to MORE than one // 'child'. I have no idea if this ever happens, but we might as well handle it. List<String> childTraces = new ArrayList<String>(children.size()); for (StepMeasurements child : children) { childTraces.add(child.getForwardTrace()); } return stackTraceElement() + "/{" + Joiner.on('|').join(childTraces) + "}"; } }
@Override public void handle(StepMeasurements measurements, int depth) { String depthText = buildDepthString(depth); String metricData = buildMetricDataString(measurements.getMetricInstances()); logger.info(String.format("%s\t%s\t%s\t%s", depthText, measurements.getForwardTrace(), measurements .getBackTrace(), metricData)); }
public void testForwardTraceShowsAction() { StepMeasurements timing = new StepMeasurements(null, PARENT, "scratchButt"); assertEquals("floop:scratchButt", timing.getForwardTrace()); }
public void testForwardTraceWithNoChildrenShowsOnlySelf() { StepMeasurements timing = new StepMeasurements(null, PARENT, null); assertEquals(PARENT, timing.getForwardTrace()); }
public void testForwardTraceWithOneChildShowsCorrectPath() { StepMeasurements timing = new StepMeasurements(null, PARENT, null); new StepMeasurements(timing, CHILD, null); assertEquals("floop/bloop", timing.getForwardTrace()); }
public void testForwardTraceWithMultipleChildrenShowsCorrectPath() { StepMeasurements timing = new StepMeasurements(null, PARENT, null); new StepMeasurements(timing, CHILD, null); new StepMeasurements(timing, OTHER_CHILD, null); assertEquals("floop/{bloop|gloop}", timing .getForwardTrace()); }