use of com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext in project honest-profiler by jvm-profiling-tools.
the class InitializeProfileTask method consume.
/**
* Returns a {@link ProfileContext} which will emit {@link LeanProfile}s produced by consuming a non-live log file.
* <p>
* @param fileLogSource the non-live log file which will be processed
* @return a new {@link ProfileContext} for non-live log file consumption
*/
private ProfileContext consume(FileLogSource fileLogSource) {
ProfileContext profileContext = newProfileContext(LOG, fileLogSource);
final LogEventListener collector = new LogEventPublisher().publishTo(getCollector(profileContext));
pipe(fileLogSource, collector, false).run();
return profileContext;
}
use of com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext in project honest-profiler by jvm-profiling-tools.
the class InitializeProfileTask method monitor.
/**
* Returns a {@link ProfileContext} which monitors {@link LeanProfile}s emitted by a {@link LeanLogCollector} based
* on a live log file.
* <p>
* @param fileLogSource the live log file from which the log events for constructing the {@link LeanProfile} are
* sourced
* @return a new {@link ProfileContext} for live monitoring
*/
private ProfileContext monitor(FileLogSource fileLogSource) {
ProfileContext profileContext = newProfileContext(LIVE, fileLogSource);
LeanLogCollector collector = getCollector(profileContext);
profileContext.setProfileSource(collector);
pipeFile(fileLogSource, collector, profileContext.getProfileListener());
return profileContext;
}
use of com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext in project honest-profiler by jvm-profiling-tools.
the class RootController method createNewProfile.
// Profile-related Helper Methods
/**
* Create a {@link Tab} which will contain the Views for a newly opened profile.
* <p>
*
* @param source the source of the profile
* @param live a boolean indicating whether the source is "live"
*/
private void createNewProfile(Object source, boolean live) {
Tab tab = newLoadingTab();
ProfileRootController controller = loadViewIntoTab(FXML_PROFILE_ROOT, tab);
tab.getContent().setVisible(false);
Task<ProfileContext> task = new InitializeProfileTask(appCtx(), source, live);
task.setOnSucceeded(event -> handleNewProfile(tab, controller, task.getValue()));
task.setOnFailed(event -> {
profileTabs.getTabs().remove(tab);
showExceptionDialog(appCtx(), appCtx().textFor(TITLE_DIALOG_ERR_OPENPROFILE), appCtx().textFor(HEADER_DIALOG_ERR_OPENPROFILE), appCtx().textFor(MESSAGE_DIALOG_ERR_OPENPROFILE), task.getException());
});
task.setOnCancelled(event -> {
profileTabs.getTabs().remove(tab);
showErrorDialog(appCtx().textFor(TITLE_DIALOG_ERR_OPENPROFILE), appCtx().textFor(HEADER_DIALOG_ERR_OPENPROFILE), appCtx().textFor(MESSAGE_DIALOG_ERR_TASKCANCELED));
});
appCtx().execute(task);
}
use of com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext in project honest-profiler by jvm-profiling-tools.
the class RootController method createDiffTab.
/**
* Create a {@link Tab} which will contain the Views for the Diff between two opened profiles.
* <p>
*
* @param baseName the name of the Base {@link ProfileContext}
* @param newName the name of the New {@link ProfileContext}
*/
public void createDiffTab(String baseName, String newName) {
Tab tab = newLoadingTab();
ProfileDiffRootController controller = loadViewIntoTab(FXML_PROFILE_DIFF_ROOT, tab);
tab.getContent().setVisible(false);
controller.setApplicationContext(appCtx());
ProfileContext baseCtx = appCtx().getProfileContext(baseName);
ProfileContext newCtx = appCtx().getProfileContext(newName);
controller.setProfileContexts(baseCtx, newCtx);
tab.setText(null);
Pane tabInfo = createColoredLabelContainer();
tab.setGraphic(tabInfo);
info(tab, INFO_TAB_PROFILEDIFF, baseName, newName);
addProfileNr(tabInfo, baseCtx);
tabInfo.getChildren().add(new Label("<->"));
addProfileNr(tabInfo, newCtx);
runLater(() -> tab.getContent().setVisible(true));
}
Aggregations