Commit d3a0b6f8 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke

#53 [Various performance improvements]

parent 4bf8b655
2.0.0:
03 Sep 2017
Internal Improvement (#53)
Performed various performance improvements. Especially the traces view should now be loaded much faster.
30 Aug 2017
Internal Improvement (#52)
The classpath for the start script is now assembled with wildcards for the libraries.
......
......@@ -16,6 +16,19 @@
package kieker.diagnosis.application.gui.aggregatedtraces;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.ListChangeListener.Change;
import javafx.collections.ObservableList;
import javafx.scene.control.TreeItem;
import kieker.diagnosis.application.gui.components.treetable.LazyAggregatedOperationCallTreeItem;
import kieker.diagnosis.application.gui.main.MainController;
import kieker.diagnosis.application.service.data.DataService;
......@@ -29,19 +42,6 @@ import kieker.diagnosis.architecture.exception.BusinessException;
import kieker.diagnosis.architecture.gui.AbstractController;
import kieker.diagnosis.architecture.service.properties.PropertiesService;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.ListChangeListener.Change;
import javafx.collections.ObservableList;
import javafx.scene.control.TreeItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* The controller for the aggregated traces.
*
......@@ -82,7 +82,7 @@ public class AggregatedTracesController extends AbstractController<AggregatedTra
}
// If we get a filter as parameter, we have to update our view accordingly
if ( aParameter.isPresent( ) && ( aParameter.get( ) instanceof AggregatedTracesFilter ) ) {
if ( aParameter.isPresent( ) && aParameter.get( ) instanceof AggregatedTracesFilter ) {
final AggregatedTracesFilter aggregatedTracesFilter = (AggregatedTracesFilter) aParameter.get( );
updateView( aggregatedTracesFilter );
performUseFilter( );
......@@ -100,12 +100,15 @@ public class AggregatedTracesController extends AbstractController<AggregatedTra
final List<AggregatedTrace> traces = ivDataService.getAggregatedTraces( );
final TreeItem<AggregatedOperationCall> root = new TreeItem<>( );
final ObservableList<TreeItem<AggregatedOperationCall>> rootChildren = root.getChildren( );
getView( ).getTreetable( ).setRoot( root );
getView( ).getTreetable( ).setShowRoot( false );
traces.stream( ).map( trace -> trace.getRootOperationCall( ) ).filter( ivPredicate )
.forEach( call -> rootChildren.add( new LazyAggregatedOperationCallTreeItem( call ) ) );
// The addAll-operation has to be performed sequentially or we will raise a concurrent modification exception.
final List<LazyAggregatedOperationCallTreeItem> filteredChildren = traces.parallelStream( ).map( trace -> trace.getRootOperationCall( ) )
.filter( ivPredicate ).map( call -> new LazyAggregatedOperationCallTreeItem( call ) ).collect( Collectors.toList( ) );
rootChildren.addAll( filteredChildren );
// Set the root after everything is prepared, or the whole GUI will be busy updating for each single element.
getView( ).getTreetable( ).setRoot( root );
getView( ).getTreetable( ).setShowRoot( false );
getView( ).getCounter( ).textProperty( ).set( rootChildren.size( ) + " " + getResourceBundle( ).getString( "counter" ) );
}
......
......@@ -158,10 +158,10 @@ public final class LazyOperationCallTreeItem extends AbstractLazyOperationCallTr
private void aggregate( final List<TreeItem<OperationCall>> aResult, final List<OperationCall> aToBeAggregated ) {
if ( !aToBeAggregated.isEmpty( ) ) {
final double percent = aToBeAggregated.stream( ).map( OperationCall::getPercent ).collect( Collectors.summingDouble( Float::doubleValue ) );
final long duration = aToBeAggregated.stream( ).map( OperationCall::getDuration ).collect( Collectors.summingLong( Long::longValue ) );
final int traceDepth = aToBeAggregated.stream( ).map( OperationCall::getStackDepth ).max( Comparator.naturalOrder( ) ).get( );
final int traceSize = aToBeAggregated.stream( ).map( OperationCall::getStackSize ).collect( Collectors.summingInt( Integer::intValue ) );
final double percent = aToBeAggregated.parallelStream( ).map( OperationCall::getPercent ).collect( Collectors.summingDouble( Float::doubleValue ) );
final long duration = aToBeAggregated.parallelStream( ).map( OperationCall::getDuration ).collect( Collectors.summingLong( Long::longValue ) );
final int traceDepth = aToBeAggregated.parallelStream( ).map( OperationCall::getStackDepth ).max( Comparator.naturalOrder( ) ).get( );
final int traceSize = aToBeAggregated.parallelStream( ).map( OperationCall::getStackSize ).collect( Collectors.summingInt( Integer::intValue ) );
final OperationCall call = new OperationCall( BLANK, BLANK, aToBeAggregated.size( ) + " " + METHOD_CALLS_AGGREGATED, getValue( ).getTraceID( ),
-1 );
call.setPercent( (float) percent );
......
......@@ -22,6 +22,7 @@ import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -278,8 +279,6 @@ public class TracesController extends AbstractController<TracesView> {
final List<Trace> traces = ivDataService.getTraces( );
final TreeItem<OperationCall> root = new TreeItem<>( );
final ObservableList<TreeItem<OperationCall>> rootChildren = root.getChildren( );
getView( ).getTreetable( ).setRoot( root );
getView( ).getTreetable( ).setShowRoot( false );
final boolean showUnmonitoredTime = ivPropertiesService.loadBooleanApplicationProperty( ShowUnmonitoredTimeProperty.class );
final boolean percentCalculation = ivPropertiesService.loadBooleanApplicationProperty( PercentCalculationProperty.class );
......@@ -287,9 +286,15 @@ public class TracesController extends AbstractController<TracesView> {
final float threshold = ivPropertiesService.loadApplicationProperty( MethodCallThresholdProperty.class );
final int maxCalls = ivPropertiesService.loadApplicationProperty( MaxNumberOfMethodCallsProperty.class );
traces.stream( ).map( trace -> trace.getRootOperationCall( ) ).filter( ivPredicate ).forEach( call -> rootChildren
.add( new LazyOperationCallTreeItem( call, showUnmonitoredTime, percentCalculation, methodCallAggregation, threshold, maxCalls ) ) );
// The addAll-operation has to be performed sequentially or we will raise a concurrent modification exception.
final List<LazyOperationCallTreeItem> filteredChildren = traces.parallelStream( ).map( trace -> trace.getRootOperationCall( ) ).filter( ivPredicate )
.map( call -> new LazyOperationCallTreeItem( call, showUnmonitoredTime, percentCalculation, methodCallAggregation, threshold, maxCalls ) )
.collect( Collectors.toList( ) );
rootChildren.addAll( filteredChildren );
// Set the root after everything is prepared, or the whole GUI will be busy updating for each single element.
getView( ).getTreetable( ).setRoot( root );
getView( ).getTreetable( ).setShowRoot( false );
getView( ).getCounter( ).textProperty( ).set( rootChildren.size( ) + " " + getResourceBundle( ).getString( "TracesView.lblCounter.text" ) );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment