stopParsing();
}
});
BorderPane borderPane = new BorderPane();
Scene scene = new Scene(borderPane, WINDOW_WIDTH, WINDOW_HEIGHT);
Button btnChooseWatchFile = new Button("Open Log");
btnChooseWatchFile.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
stopParsing();
chooseHotSpotFile();
}
});
btnStart = new Button("Start");
btnStart.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
if (nothingMountedStage == null)
{
int classCount = getConfig().getClassLocations().size();
int sourceCount = getConfig().getSourceLocations().size();
if (classCount == 0 && sourceCount == 0)
{
if (getConfig().isShowNothingMounted())
{
nothingMountedStage = new NothingMountedStage(JITWatchUI.this, getConfig());
StageManager.addAndShow(nothingMountedStage);
startDelayedByConfig = true;
}
}
}
if (!startDelayedByConfig)
{
readLogFile();
}
}
});
btnStop = new Button("Stop");
btnStop.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
stopParsing();
}
});
btnConfigure = new Button("Config");
btnConfigure.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
openConfigStage();
}
});
btnTimeLine = new Button("Chart");
btnTimeLine.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
timeLineStage = new TimeLineStage(JITWatchUI.this);
StageManager.addAndShow(timeLineStage);
btnTimeLine.setDisable(true);
}
});
btnStats = new Button("Stats");
btnStats.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
statsStage = new StatsStage(JITWatchUI.this);
StageManager.addAndShow(statsStage);
btnStats.setDisable(true);
}
});
btnHisto = new Button("Histo");
btnHisto.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
histoStage = new HistoStage(JITWatchUI.this);
StageManager.addAndShow(histoStage);
btnHisto.setDisable(true);
}
});
btnTopList = new Button("TopList");
btnTopList.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
topListStage = new TopListStage(JITWatchUI.this);
StageManager.addAndShow(topListStage);
btnTopList.setDisable(true);
}
});
btnCodeCache = new Button("Code Cache");
btnCodeCache.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
codeCacheStage = new CodeCacheStage(JITWatchUI.this);
StageManager.addAndShow(codeCacheStage);
btnCodeCache.setDisable(true);
}
});
btnTriView = new Button("TriView");
btnTriView.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
if (selectedMember == null && selectedMetaClass != null)
{
selectedMember = selectedMetaClass.getFirstConstructor();
}
openTriView(selectedMember, false);
}
});
btnSuggest = new Button("Suggest");
btnSuggest.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
suggestStage = new SuggestStage(JITWatchUI.this, suggestions);
StageManager.addAndShow(suggestStage);
btnSuggest.setDisable(true);
}
});
btnSandbox = new Button("Sandbox");
btnSandbox.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
openSandbox();
}
});
btnErrorLog = new Button("Errors (0)");
btnErrorLog.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
openTextViewer("Error Log", errorLog.toString(), false, false);
}
});
btnErrorLog.setStyle("-fx-padding: 2 6;");
lblHeap = new Label();
lblVmVersion = new Label();
StringBuilder vmBuilder = new StringBuilder();
vmBuilder.append("VM is ");
vmBuilder.append(Runtime.class.getPackage().getImplementationVendor());
vmBuilder.append(C_SPACE);
vmBuilder.append(Runtime.class.getPackage().getImplementationVersion());
lblVmVersion.setText(vmBuilder.toString());
lblTweakLog = new Label();
int menuBarHeight = 40;
int textAreaHeight = 100;
int statusBarHeight = 25;
HBox hboxTop = new HBox();
hboxTop.setPadding(new Insets(10));
hboxTop.setPrefHeight(menuBarHeight);
hboxTop.setSpacing(10);
hboxTop.getChildren().add(btnSandbox);
hboxTop.getChildren().add(btnChooseWatchFile);
hboxTop.getChildren().add(btnStart);
hboxTop.getChildren().add(btnStop);
hboxTop.getChildren().add(btnConfigure);
hboxTop.getChildren().add(btnTimeLine);
hboxTop.getChildren().add(btnStats);
hboxTop.getChildren().add(btnHisto);
hboxTop.getChildren().add(btnTopList);
hboxTop.getChildren().add(btnCodeCache);
hboxTop.getChildren().add(btnTriView);
hboxTop.getChildren().add(btnSuggest);
memberAttrList = FXCollections.observableArrayList();
attributeTableView = TableUtil.buildTableMemberAttributes(memberAttrList);
attributeTableView.setPlaceholder(new Text("Select a JIT-compiled class member to view compilation attributes."));
SplitPane spMethodInfo = new SplitPane();
spMethodInfo.setOrientation(Orientation.VERTICAL);
classMemberList = new ClassMemberList(this, getConfig());
spMethodInfo.getItems().add(classMemberList);
spMethodInfo.getItems().add(attributeTableView);
classMemberList.prefHeightProperty().bind(scene.heightProperty());
attributeTableView.prefHeightProperty().bind(scene.heightProperty());
classTree = new ClassTree(this, getConfig());
classTree.prefWidthProperty().bind(scene.widthProperty());
SplitPane spMain = new SplitPane();
spMain.setOrientation(Orientation.VERTICAL);
SplitPane spCentre = new SplitPane();
spCentre.getItems().add(classTree);
spCentre.getItems().add(spMethodInfo);
spCentre.setDividerPositions(0.33, 0.67);
textAreaLog = new TextArea();
textAreaLog.setStyle("-fx-font-family:monospace;-fx-font-size:12px");
textAreaLog.setPrefHeight(textAreaHeight);
log("Welcome to JITWatch by Chris Newland (@chriswhocodes on Twitter) and the AdoptOpenJDK project.\n");
log("Please send feedback to our mailing list (https://groups.google.com/forum/#!forum/jitwatch) \nor come and find us on GitHub (https://github.com/AdoptOpenJDK/jitwatch).\n");
log("Includes assembly reference from x86asm.net licenced under http://ref.x86asm.net/index.html#License\n");
if (hsLogFile == null)
{
log("Choose a HotSpot log file or open the Sandbox");
}
else
{
log("Using HotSpot log file: " + hsLogFile.getAbsolutePath());
}
spMain.getItems().add(spCentre);
spMain.getItems().add(textAreaLog);
spMain.setDividerPositions(0.68, 0.32);
HBox hboxBottom = new HBox();
Region springLeft = new Region();
Region springRight = new Region();
final String labelStyle = "-fx-padding: 3 0 0 0;";
HBox.setHgrow(springLeft, Priority.ALWAYS);
HBox.setHgrow(springRight, Priority.ALWAYS);
lblHeap.setStyle(labelStyle);
lblVmVersion.setStyle(labelStyle);
hboxBottom.setPadding(new Insets(4));
hboxBottom.setPrefHeight(statusBarHeight);
hboxBottom.setSpacing(4);
hboxBottom.getChildren().add(lblHeap);
hboxBottom.getChildren().add(btnErrorLog);
hboxBottom.getChildren().add(springLeft);
hboxBottom.getChildren().add(lblTweakLog);
hboxBottom.getChildren().add(springRight);
hboxBottom.getChildren().add(lblVmVersion);
borderPane.setTop(hboxTop);
borderPane.setCenter(spMain);
borderPane.setBottom(hboxBottom);
stage.setTitle("JITWatch - HotSpot Compilation Inspector");
stage.setScene(scene);
stage.show();