Search in sources :

Example 1 with ProfileFilter

use of com.insightfullogic.honest_profiler.core.filters.ProfileFilter in project honest-profiler by jvm-profiling-tools.

the class ConsoleApplication method displayLogFile.

private void displayLogFile() {
    try {
        if (!logLocation.exists() || !logLocation.canRead()) {
            error.stream().println("Unable to find log file at: " + logLocation);
            return;
        }
        ProfileListener listener = ui;
        if (filterDescription != null) {
            ProfileFilter filter = new ProfileFilter();
            filter.updateFilters(filterDescription);
            listener = profile -> {
                filter.accept(profile);
                ui.accept(profile);
            };
        }
        output.stream().println("Printing Profile for: " + logLocation.getAbsolutePath());
        Monitor.consumeFile(new FileLogSource(logLocation), listener);
    } catch (Exception e) {
        // TODO: better error handling
        e.printStackTrace(error.stream());
    }
}
Also used : ProfileListener(com.insightfullogic.honest_profiler.core.profiles.ProfileListener) FileLogSource(com.insightfullogic.honest_profiler.ports.sources.FileLogSource) ProfileFilter(com.insightfullogic.honest_profiler.core.filters.ProfileFilter) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

ProfileFilter (com.insightfullogic.honest_profiler.core.filters.ProfileFilter)1 ProfileListener (com.insightfullogic.honest_profiler.core.profiles.ProfileListener)1 FileLogSource (com.insightfullogic.honest_profiler.ports.sources.FileLogSource)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1