Search in sources :

Example 1 with ProfileContext

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;
}
Also used : ProfileContext(com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext) LogEventListener(com.insightfullogic.honest_profiler.core.parser.LogEventListener) LogEventPublisher(com.insightfullogic.honest_profiler.core.parser.LogEventPublisher)

Example 2 with 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;
}
Also used : LeanLogCollector(com.insightfullogic.honest_profiler.core.collector.lean.LeanLogCollector) ProfileContext(com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext)

Example 3 with 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);
}
Also used : Tab(javafx.scene.control.Tab) ProfileContext(com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext) InitializeProfileTask(com.insightfullogic.honest_profiler.ports.javafx.model.task.InitializeProfileTask)

Example 4 with ProfileContext

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));
}
Also used : Tab(javafx.scene.control.Tab) ProfileContext(com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext) Label(javafx.scene.control.Label) TabPane(javafx.scene.control.TabPane) Pane(javafx.scene.layout.Pane)

Aggregations

ProfileContext (com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext)4 Tab (javafx.scene.control.Tab)2 LeanLogCollector (com.insightfullogic.honest_profiler.core.collector.lean.LeanLogCollector)1 LogEventListener (com.insightfullogic.honest_profiler.core.parser.LogEventListener)1 LogEventPublisher (com.insightfullogic.honest_profiler.core.parser.LogEventPublisher)1 InitializeProfileTask (com.insightfullogic.honest_profiler.ports.javafx.model.task.InitializeProfileTask)1 Label (javafx.scene.control.Label)1 TabPane (javafx.scene.control.TabPane)1 Pane (javafx.scene.layout.Pane)1