From fa843ac753ba508ac715c64c9d0e87e18993185d Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Mon, 8 Dec 2014 17:39:20 +0100 Subject: [PATCH] Added duration to the trace aggregation --- .../domain/AggregatedExecutionEntry.java | 28 +++++++++++++++- .../importer/filter/TraceAggregator.java | 2 +- .../view/AggregatedTraceDetailComposite.java | 32 ++++++++++++++++++- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/main/java/kieker/gui/model/domain/AggregatedExecutionEntry.java b/src/main/java/kieker/gui/model/domain/AggregatedExecutionEntry.java index 8c2534ce..391c0339 100644 --- a/src/main/java/kieker/gui/model/domain/AggregatedExecutionEntry.java +++ b/src/main/java/kieker/gui/model/domain/AggregatedExecutionEntry.java @@ -26,6 +26,8 @@ public final class AggregatedExecutionEntry { private final String container; private final String component; private final String operation; + private long minDuration; + private long maxDuration; private int calls; public AggregatedExecutionEntry(final ExecutionEntry execEntry) { @@ -33,12 +35,26 @@ public final class AggregatedExecutionEntry { this.component = execEntry.getComponent(); this.operation = execEntry.getOperation(); this.failedCause = execEntry.getFailedCause(); + this.minDuration = execEntry.getDuration(); + this.maxDuration = execEntry.getDuration(); for (final ExecutionEntry child : execEntry.getChildren()) { this.children.add(new AggregatedExecutionEntry(child)); } } + public int getStackDepth() { + int stackDepth = this.children.isEmpty() ? 0 : 1; + + int maxChildrenStackDepth = 0; + for (final AggregatedExecutionEntry child : this.children) { + maxChildrenStackDepth = Math.max(maxChildrenStackDepth, child.getStackDepth()); + } + stackDepth += maxChildrenStackDepth; + + return stackDepth; + } + public List<AggregatedExecutionEntry> getChildren() { return this.children; } @@ -55,8 +71,18 @@ public final class AggregatedExecutionEntry { return this.operation; } - public void incrementCalls() { + public void incrementCalls(final ExecutionEntry executionEntry) { this.calls++; + this.minDuration = Math.min(this.minDuration, executionEntry.getDuration()); + this.maxDuration = Math.max(this.maxDuration, executionEntry.getDuration()); + } + + public long getMinDuration() { + return this.minDuration; + } + + public long getMaxDuration() { + return this.maxDuration; } public int getCalls() { diff --git a/src/main/java/kieker/gui/model/importer/filter/TraceAggregator.java b/src/main/java/kieker/gui/model/importer/filter/TraceAggregator.java index 609422c6..35739393 100644 --- a/src/main/java/kieker/gui/model/importer/filter/TraceAggregator.java +++ b/src/main/java/kieker/gui/model/importer/filter/TraceAggregator.java @@ -40,7 +40,7 @@ public final class TraceAggregator extends AbstractConsumerStage<ExecutionEntry> final AggregatedExecutionEntry aggregatedExecutionEntry = new AggregatedExecutionEntry(executionEntry); this.aggregationMap.put(executionEntry, aggregatedExecutionEntry); } - this.aggregationMap.get(executionEntry).incrementCalls(); + this.aggregationMap.get(executionEntry).incrementCalls(executionEntry); } @Override diff --git a/src/main/java/kieker/gui/view/AggregatedTraceDetailComposite.java b/src/main/java/kieker/gui/view/AggregatedTraceDetailComposite.java index 546cf001..f0e8bc7a 100644 --- a/src/main/java/kieker/gui/view/AggregatedTraceDetailComposite.java +++ b/src/main/java/kieker/gui/view/AggregatedTraceDetailComposite.java @@ -17,8 +17,10 @@ public final class AggregatedTraceDetailComposite extends Composite { private final Label lblOperationDisplay; private final Label lblFailed; private final Label lblFailedDisplay; - private final Label lblCalledDisplay; + private final Label lblStackDepthDisplay; + private final Label lblMinimalDurationDisplay; + private final Label lblMaximalDurationDisplay; public AggregatedTraceDetailComposite(final Composite parent, final int style) { super(parent, style); @@ -52,6 +54,14 @@ public final class AggregatedTraceDetailComposite extends Composite { this.lblOperationDisplay.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); this.lblOperationDisplay.setText("N/A"); + final Label lblStackDepth = new Label(this, SWT.NONE); + lblStackDepth.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + lblStackDepth.setText("Stack Depth:"); + + this.lblStackDepthDisplay = new Label(this, SWT.NONE); + this.lblStackDepthDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + this.lblStackDepthDisplay.setText("N/A"); + this.lblFailed = new Label(this, SWT.NONE); this.lblFailed.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); this.lblFailed.setText("Failed:"); @@ -68,14 +78,34 @@ public final class AggregatedTraceDetailComposite extends Composite { this.lblCalledDisplay = new Label(this, SWT.NONE); this.lblCalledDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); this.lblCalledDisplay.setText("N/A"); + + final Label lblMinimalDuration = new Label(this, SWT.NONE); + lblMinimalDuration.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + lblMinimalDuration.setText("Minimal Duration:"); + + this.lblMinimalDurationDisplay = new Label(this, SWT.NONE); + this.lblMinimalDurationDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + this.lblMinimalDurationDisplay.setText("N/A"); + + final Label lblMaximalDuration = new Label(this, SWT.NONE); + lblMaximalDuration.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + lblMaximalDuration.setText("Maximal Duration:"); + + this.lblMaximalDurationDisplay = new Label(this, SWT.NONE); + this.lblMaximalDurationDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + this.lblMaximalDurationDisplay.setText("N/A"); } public void setTraceToDisplay(final AggregatedExecutionEntry trace) { this.lblExecutionContainerDisplay.setText(trace.getContainer()); this.lblComponentDisplay.setText(trace.getComponent()); this.lblOperationDisplay.setText(trace.getOperation()); + this.lblStackDepthDisplay.setText(Integer.toString(trace.getStackDepth())); this.lblCalledDisplay.setText(Integer.toString(trace.getCalls())); + this.lblMinimalDurationDisplay.setText(Long.toString(trace.getMinDuration())); + this.lblMaximalDurationDisplay.setText(Long.toString(trace.getMaxDuration())); + if (trace.isFailed()) { this.lblFailedDisplay.setText("Yes (" + trace.getFailedCause() + ")"); this.lblFailedDisplay.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); -- GitLab