Skip to content

Commit

Permalink
Added snapshot to codecache view, repackaged lock optimisation reports
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswhocodes committed Oct 18, 2017
1 parent f7c372b commit 43658fe
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 71 deletions.
Expand Up @@ -3,16 +3,16 @@
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
*/ */
package org.adoptopenjdk.jitwatch.report.escapeanalysis.lockelision; package org.adoptopenjdk.jitwatch.report.locks;


import org.adoptopenjdk.jitwatch.model.IReadOnlyJITDataModel; import org.adoptopenjdk.jitwatch.model.IReadOnlyJITDataModel;
import org.adoptopenjdk.jitwatch.model.bytecode.BCAnnotationType; import org.adoptopenjdk.jitwatch.model.bytecode.BCAnnotationType;
import org.adoptopenjdk.jitwatch.model.bytecode.LineAnnotation; import org.adoptopenjdk.jitwatch.model.bytecode.LineAnnotation;
import org.adoptopenjdk.jitwatch.report.escapeanalysis.AbstractEscapeAnalysisWalker; import org.adoptopenjdk.jitwatch.report.escapeanalysis.AbstractEscapeAnalysisWalker;


public class ElidedLocksWalker extends AbstractEscapeAnalysisWalker public class OptimisedLocksWalker extends AbstractEscapeAnalysisWalker
{ {
public ElidedLocksWalker(IReadOnlyJITDataModel model) public OptimisedLocksWalker(IReadOnlyJITDataModel model)
{ {
super(model); super(model);
} }
Expand Down
Expand Up @@ -36,6 +36,8 @@
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane; import javafx.scene.layout.Pane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon; import javafx.scene.shape.Polygon;
Expand Down Expand Up @@ -73,7 +75,7 @@ public class CodeCacheLayoutStage extends Stage implements IRedrawable, ICompila
private Button btnZoomOut; private Button btnZoomOut;
private Button btnZoomReset; private Button btnZoomReset;
private Button btnAnimate; private Button btnAnimate;

private CheckBox checkC1; private CheckBox checkC1;
private CheckBox checkC2; private CheckBox checkC2;


Expand Down Expand Up @@ -113,14 +115,14 @@ public CodeCacheLayoutStage(final JITWatchUI parent)


borderPane.setTop(scrollPane); borderPane.setTop(scrollPane);


VBox vBoxControls = buildControls(); Scene scene = UserInterfaceUtil.getScene(borderPane, JITWatchUI.WINDOW_WIDTH, JITWatchUI.WINDOW_HEIGHT);

VBox vBoxControls = buildControls(scene);


borderPane.setCenter(vBoxControls); borderPane.setCenter(vBoxControls);


borderPane.setBottom(nMethodInfo); borderPane.setBottom(nMethodInfo);


Scene scene = UserInterfaceUtil.getScene(borderPane, JITWatchUI.WINDOW_WIDTH, JITWatchUI.WINDOW_HEIGHT);

scrollPane.prefWidthProperty().bind(scene.widthProperty()); scrollPane.prefWidthProperty().bind(scene.widthProperty());
scrollPane.prefHeightProperty().bind(scene.heightProperty().multiply(0.5)); scrollPane.prefHeightProperty().bind(scene.heightProperty().multiply(0.5));


Expand All @@ -142,22 +144,22 @@ public CodeCacheLayoutStage(final JITWatchUI parent)
setScene(scene); setScene(scene);
} }


private VBox buildControls() private VBox buildControls(Scene scene)
{ {
VBox vBoxControls = new VBox(); VBox vBoxControls = new VBox();


vBoxControls.getChildren().addAll(buildControlButtons(), buildControlInfo()); vBoxControls.getChildren().addAll(buildControlButtons(scene), buildControlInfo());


return vBoxControls; return vBoxControls;
} }


private HBox buildControlButtons() private HBox buildControlButtons(Scene scene)
{ {
HBox hboxControls = new HBox(); HBox hboxControls = new HBox();


hboxControls.setSpacing(10); hboxControls.setSpacing(10);
hboxControls.setAlignment(Pos.CENTER_LEFT); hboxControls.setAlignment(Pos.CENTER_LEFT);
hboxControls.setPadding(new Insets(4, 0, 0, 8)); hboxControls.setPadding(new Insets(4, 4, 0, 8));


btnZoomIn = new Button("Zoom In"); btnZoomIn = new Button("Zoom In");
btnZoomOut = new Button("Zoom Out"); btnZoomOut = new Button("Zoom Out");
Expand Down Expand Up @@ -244,7 +246,12 @@ public void handle(ActionEvent e)
} }
}); });


hboxControls.getChildren().addAll(checkC1, checkC2, btnZoomIn, btnZoomOut, btnZoomReset, btnAnimate, txtAnimationSeconds); Region spacerStatus = new Region();
HBox.setHgrow(spacerStatus, Priority.ALWAYS);

Button buttonSnapShot = UserInterfaceUtil.getSnapshotButton(scene, "CodeCache");

hboxControls.getChildren().addAll(checkC1, checkC2, btnZoomIn, btnZoomOut, btnZoomReset, btnAnimate, txtAnimationSeconds, spacerStatus, buttonSnapShot);


return hboxControls; return hboxControls;
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@


import static org.adoptopenjdk.jitwatch.util.UserInterfaceUtil.fix; import static org.adoptopenjdk.jitwatch.util.UserInterfaceUtil.fix;


import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.S_EMPTY;
import org.adoptopenjdk.jitwatch.chain.CompileChainWalker; import org.adoptopenjdk.jitwatch.chain.CompileChainWalker;
import org.adoptopenjdk.jitwatch.chain.CompileNode; import org.adoptopenjdk.jitwatch.chain.CompileNode;
import org.adoptopenjdk.jitwatch.model.Compilation; import org.adoptopenjdk.jitwatch.model.Compilation;
Expand All @@ -22,8 +23,10 @@
import org.adoptopenjdk.jitwatch.util.UserInterfaceUtil; import org.adoptopenjdk.jitwatch.util.UserInterfaceUtil;


import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
Expand All @@ -45,6 +48,9 @@ public class CompileChainStage extends Stage implements ICompilationChangeListen
private ScrollPane scrollPane; private ScrollPane scrollPane;
private Pane pane; private Pane pane;
private IStageAccessProxy stageAccess; private IStageAccessProxy stageAccess;

private Label labelRootNodeMember;

private CompilationChooser compilationChooser; private CompilationChooser compilationChooser;


private CompileNode rootNode; private CompileNode rootNode;
Expand Down Expand Up @@ -96,13 +102,18 @@ public CompileChainStage(IMemberSelectedListener selectionListener, final IStage


HBox hBox = new HBox(); HBox hBox = new HBox();


labelRootNodeMember = new Label();

hBox.getChildren().add(labelRootNodeMember);
hBox.getChildren().add(compilationChooser.getCombo()); hBox.getChildren().add(compilationChooser.getCombo());
hBox.getChildren().add(spacer); hBox.getChildren().add(spacer);
hBox.getChildren().add(buttonSnapShot); hBox.getChildren().add(buttonSnapShot);


hBox.setSpacing(16.0);
hBox.setPadding(new Insets(4, 4, 4, 4));

verticalLayout.getChildren().addAll(hBox, scrollPane); verticalLayout.getChildren().addAll(hBox, scrollPane);



RateLimitedResizeListener resizeListener = new RateLimitedResizeListener(this, 200); RateLimitedResizeListener resizeListener = new RateLimitedResizeListener(this, 200);


pane.widthProperty().addListener(resizeListener); pane.widthProperty().addListener(resizeListener);
Expand Down Expand Up @@ -350,14 +361,20 @@ private void buildTree(IMetaMember member)


this.rootNode = root; this.rootNode = root;


title += root.getMemberName() + " " + root.getCompilation().getSignature(); String rootMemberName = getLabelText(root);

title += rootMemberName + " " + root.getCompilation().getSignature();


setTitle(title); setTitle(title);

labelRootNodeMember.setText(rootMemberName);
} }
else else
{ {
rootNode = null; rootNode = null;


labelRootNodeMember.setText(S_EMPTY);

clear(); clear();


Text text = new Text(member.toString() + " was not JIT compiled"); Text text = new Text(member.toString() + " was not JIT compiled");
Expand Down
42 changes: 21 additions & 21 deletions ui/src/main/java/org/adoptopenjdk/jitwatch/ui/main/JITWatchUI.java
Expand Up @@ -39,8 +39,8 @@
import org.adoptopenjdk.jitwatch.report.Report; import org.adoptopenjdk.jitwatch.report.Report;
import org.adoptopenjdk.jitwatch.report.comparator.ScoreComparator; import org.adoptopenjdk.jitwatch.report.comparator.ScoreComparator;
import org.adoptopenjdk.jitwatch.report.escapeanalysis.eliminatedallocation.EliminatedAllocationWalker; import org.adoptopenjdk.jitwatch.report.escapeanalysis.eliminatedallocation.EliminatedAllocationWalker;
import org.adoptopenjdk.jitwatch.report.escapeanalysis.lockelision.ElidedLocksWalker;
import org.adoptopenjdk.jitwatch.report.inlining.InliningWalker; import org.adoptopenjdk.jitwatch.report.inlining.InliningWalker;
import org.adoptopenjdk.jitwatch.report.locks.OptimisedLocksWalker;
import org.adoptopenjdk.jitwatch.report.suggestion.SuggestionWalker; import org.adoptopenjdk.jitwatch.report.suggestion.SuggestionWalker;
import org.adoptopenjdk.jitwatch.ui.Dialogs; import org.adoptopenjdk.jitwatch.ui.Dialogs;
import org.adoptopenjdk.jitwatch.ui.browser.BrowserStage; import org.adoptopenjdk.jitwatch.ui.browser.BrowserStage;
Expand Down Expand Up @@ -163,7 +163,7 @@ public class JITWatchUI extends Application
private Button btnTriView; private Button btnTriView;
private Button btnReportSuggestions; private Button btnReportSuggestions;
private Button btnReportEliminatedAllocations; private Button btnReportEliminatedAllocations;
private Button btnReportElidedLocks; private Button btnReportOptimisedLocks;
private Button btnSandbox; private Button btnSandbox;


private Label lblHeap; private Label lblHeap;
Expand All @@ -180,7 +180,7 @@ public class JITWatchUI extends Application


private ReportStage reportStageSuggestions; private ReportStage reportStageSuggestions;
private ReportStage reportStageElminatedAllocations; private ReportStage reportStageElminatedAllocations;
private ReportStage reportStageElidedLocks; private ReportStage reportStageOptimisedLocks;


private SandboxStage sandBoxStage; private SandboxStage sandBoxStage;


Expand All @@ -191,7 +191,7 @@ public class JITWatchUI extends Application


private List<Report> reportListSuggestions = new ArrayList<>(); private List<Report> reportListSuggestions = new ArrayList<>();
private List<Report> reportListEliminatedAllocations = new ArrayList<>(); private List<Report> reportListEliminatedAllocations = new ArrayList<>();
private List<Report> reportListElidedLocks = new ArrayList<>(); private List<Report> reportListOptimisedLocks = new ArrayList<>();


private CodeCacheWalkerResult codeCacheWalkerResult; private CodeCacheWalkerResult codeCacheWalkerResult;


Expand Down Expand Up @@ -271,7 +271,7 @@ private void clear()


reportListSuggestions.clear(); reportListSuggestions.clear();
reportListEliminatedAllocations.clear(); reportListEliminatedAllocations.clear();
reportListElidedLocks.clear(); reportListOptimisedLocks.clear();


Platform.runLater(new Runnable() Platform.runLater(new Runnable()
{ {
Expand Down Expand Up @@ -312,7 +312,7 @@ public void handleReadComplete()


buildEliminatedAllocationReport(); buildEliminatedAllocationReport();


buildElidedLocksReport(); buildOptimisedLocksReport();


Platform.runLater(new Runnable() Platform.runLater(new Runnable()
{ {
Expand Down Expand Up @@ -350,15 +350,15 @@ private void buildEliminatedAllocationReport()
log("Found " + reportListEliminatedAllocations.size() + " eliminated allocations."); log("Found " + reportListEliminatedAllocations.size() + " eliminated allocations.");
} }


private void buildElidedLocksReport() private void buildOptimisedLocksReport()
{ {
log("Finding elided locks"); log("Finding optimised locks");


ElidedLocksWalker walker = new ElidedLocksWalker(logParser.getModel()); OptimisedLocksWalker walker = new OptimisedLocksWalker(logParser.getModel());


reportListElidedLocks = walker.getReports(new ScoreComparator()); reportListOptimisedLocks = walker.getReports(new ScoreComparator());


log("Found " + reportListElidedLocks.size() + " elided locks."); log("Found " + reportListOptimisedLocks.size() + " optimised locks.");
} }


private CodeCacheWalkerResult buildCodeCacheResult() private CodeCacheWalkerResult buildCodeCacheResult()
Expand Down Expand Up @@ -618,18 +618,18 @@ public void handle(ActionEvent e)
} }
}); });


btnReportElidedLocks = new Button("-Locks"); btnReportOptimisedLocks = new Button("-Locks");
btnReportElidedLocks.setOnAction(new EventHandler<ActionEvent>() btnReportOptimisedLocks.setOnAction(new EventHandler<ActionEvent>()
{ {
@Override @Override
public void handle(ActionEvent e) public void handle(ActionEvent e)
{ {
reportStageElidedLocks = new ReportStage(JITWatchUI.this, "JITWatch Elided Lock Report", reportStageOptimisedLocks = new ReportStage(JITWatchUI.this, "JITWatch Optimised Lock Report",
ReportStageType.ELIDED_LOCK, reportListElidedLocks); ReportStageType.ELIDED_LOCK, reportListOptimisedLocks);


StageManager.addAndShow(JITWatchUI.this.stage, reportStageElidedLocks); StageManager.addAndShow(JITWatchUI.this.stage, reportStageOptimisedLocks);


btnReportElidedLocks.setDisable(true); btnReportOptimisedLocks.setDisable(true);
} }
}); });


Expand Down Expand Up @@ -718,7 +718,7 @@ public void handle(ActionEvent e)
hboxTop.getChildren().add(btnTriView); hboxTop.getChildren().add(btnTriView);
hboxTop.getChildren().add(btnReportSuggestions); hboxTop.getChildren().add(btnReportSuggestions);
hboxTop.getChildren().add(btnReportEliminatedAllocations); hboxTop.getChildren().add(btnReportEliminatedAllocations);
hboxTop.getChildren().add(btnReportElidedLocks); hboxTop.getChildren().add(btnReportOptimisedLocks);


compilationRowList = FXCollections.observableArrayList(); compilationRowList = FXCollections.observableArrayList();
compilationTable = CompilationTableBuilder.buildTableMemberAttributes(compilationRowList); compilationTable = CompilationTableBuilder.buildTableMemberAttributes(compilationRowList);
Expand Down Expand Up @@ -936,7 +936,7 @@ private void updateButtons()


btnReportSuggestions.setText("Suggestions (" + reportListSuggestions.size() + S_CLOSE_PARENTHESES); btnReportSuggestions.setText("Suggestions (" + reportListSuggestions.size() + S_CLOSE_PARENTHESES);
btnReportEliminatedAllocations.setText("-Allocs (" + reportListEliminatedAllocations.size() + S_CLOSE_PARENTHESES); btnReportEliminatedAllocations.setText("-Allocs (" + reportListEliminatedAllocations.size() + S_CLOSE_PARENTHESES);
btnReportElidedLocks.setText("-Locks (" + reportListElidedLocks.size() + S_CLOSE_PARENTHESES); btnReportOptimisedLocks.setText("-Locks (" + reportListOptimisedLocks.size() + S_CLOSE_PARENTHESES);
} }


public boolean focusTreeOnClass(MetaClass metaClass, boolean unsetSelection) public boolean focusTreeOnClass(MetaClass metaClass, boolean unsetSelection)
Expand Down Expand Up @@ -1424,8 +1424,8 @@ else if (stage instanceof ReportStage)
reportStageElminatedAllocations = null; reportStageElminatedAllocations = null;
break; break;
case ELIDED_LOCK: case ELIDED_LOCK:
btnReportElidedLocks.setDisable(false); btnReportOptimisedLocks.setDisable(false);
reportStageElidedLocks = null; reportStageOptimisedLocks = null;
break; break;
case INLINING: case INLINING:
break; break;
Expand Down
Expand Up @@ -16,12 +16,12 @@
import org.adoptopenjdk.jitwatch.ui.main.JITWatchUI; import org.adoptopenjdk.jitwatch.ui.main.JITWatchUI;
import org.adoptopenjdk.jitwatch.ui.report.cell.LinkedBCICell; import org.adoptopenjdk.jitwatch.ui.report.cell.LinkedBCICell;
import org.adoptopenjdk.jitwatch.ui.report.cell.MemberTableCell; import org.adoptopenjdk.jitwatch.ui.report.cell.MemberTableCell;
import org.adoptopenjdk.jitwatch.ui.report.elidedlock.ElidedLockRowBean;
import org.adoptopenjdk.jitwatch.ui.report.elidedlock.ElidedLockRowBuilder;
import org.adoptopenjdk.jitwatch.ui.report.eliminatedallocation.EliminatedAllocationRowBean; import org.adoptopenjdk.jitwatch.ui.report.eliminatedallocation.EliminatedAllocationRowBean;
import org.adoptopenjdk.jitwatch.ui.report.eliminatedallocation.EliminatedAllocationRowBuilder; import org.adoptopenjdk.jitwatch.ui.report.eliminatedallocation.EliminatedAllocationRowBuilder;
import org.adoptopenjdk.jitwatch.ui.report.inlining.InliningRowBean; import org.adoptopenjdk.jitwatch.ui.report.inlining.InliningRowBean;
import org.adoptopenjdk.jitwatch.ui.report.inlining.InliningRowBuilder; import org.adoptopenjdk.jitwatch.ui.report.inlining.InliningRowBuilder;
import org.adoptopenjdk.jitwatch.ui.report.locks.OptimisedLockRowBean;
import org.adoptopenjdk.jitwatch.ui.report.locks.OptimisedLockRowBuilder;
import org.adoptopenjdk.jitwatch.ui.report.suggestion.SuggestionRowBean; import org.adoptopenjdk.jitwatch.ui.report.suggestion.SuggestionRowBean;
import org.adoptopenjdk.jitwatch.ui.report.suggestion.SuggestionRowBuilder; import org.adoptopenjdk.jitwatch.ui.report.suggestion.SuggestionRowBuilder;
import org.adoptopenjdk.jitwatch.util.UserInterfaceUtil; import org.adoptopenjdk.jitwatch.util.UserInterfaceUtil;
Expand Down Expand Up @@ -74,19 +74,19 @@ public ReportStage(final IStageAccessProxy proxy, String title, ReportStageType
{ {
case SUGGESTION: case SUGGESTION:
setTitle(title); setTitle(title);
tableView = SuggestionRowBuilder.buildTableSuggestion(observableList); tableView = SuggestionRowBuilder.buildTable(observableList);
break; break;
case ELIMINATED_ALLOCATION: case ELIMINATED_ALLOCATION:
setTitle(title); setTitle(title);
tableView = EliminatedAllocationRowBuilder.buildTableSuggestion(observableList); tableView = EliminatedAllocationRowBuilder.buildTable(observableList);
break; break;
case ELIDED_LOCK: case ELIDED_LOCK:
setTitle(title); setTitle(title);
tableView = ElidedLockRowBuilder.buildTableSuggestion(observableList); tableView = OptimisedLockRowBuilder.buildTable(observableList);
break; break;
case INLINING: case INLINING:
setTitle(title); setTitle(title);
tableView = InliningRowBuilder.buildTableSuggestion(observableList); tableView = InliningRowBuilder.buildTable(observableList);
break; break;
} }


Expand Down Expand Up @@ -153,7 +153,7 @@ private void display()
observableList.add(new EliminatedAllocationRowBean(report)); observableList.add(new EliminatedAllocationRowBean(report));
break; break;
case ELIDED_LOCK: case ELIDED_LOCK:
observableList.add(new ElidedLockRowBean(report)); observableList.add(new OptimisedLockRowBean(report));
break; break;
case INLINING: case INLINING:
observableList.add(new InliningRowBean(report)); observableList.add(new InliningRowBean(report));
Expand Down
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 Chris Newland. * Copyright (c) 2013-2017 Chris Newland.
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
*/ */
Expand All @@ -23,7 +23,7 @@ private EliminatedAllocationRowBuilder()
{ {
} }


public static TableView<IReportRowBean> buildTableSuggestion(ObservableList<IReportRowBean> rows) public static TableView<IReportRowBean> buildTable(ObservableList<IReportRowBean> rows)
{ {
TableView<IReportRowBean> tv = new TableView<>(); TableView<IReportRowBean> tv = new TableView<>();


Expand Down
Expand Up @@ -23,7 +23,7 @@ private InliningRowBuilder()
{ {
} }


public static TableView<IReportRowBean> buildTableSuggestion(ObservableList<IReportRowBean> rows) public static TableView<IReportRowBean> buildTable(ObservableList<IReportRowBean> rows)
{ {
TableView<IReportRowBean> tv = new TableView<>(); TableView<IReportRowBean> tv = new TableView<>();


Expand Down

0 comments on commit 43658fe

Please sign in to comment.