Java Code Examples for one.profiler.AsyncProfiler

The following examples show how to use one.profiler.AsyncProfiler. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: arthas   Source File: ProfilerCommand.java    License: Apache License 2.0 6 votes vote down vote up
private AsyncProfiler profilerInstance() {
    if (profiler != null) {
        return profiler;
    }

    // try to load from special path
    if (ProfilerAction.load.toString().equals(action)) {
        profiler = AsyncProfiler.getInstance(this.actionArg);
    }

    if (libPath != null) {
        // load from arthas directory
        profiler = AsyncProfiler.getInstance(libPath);
    } else {
        if (OSUtils.isLinux() || OSUtils.isMac()) {
            throw new IllegalStateException("Can not find libasyncProfiler so, please check the arthas directory.");
        } else {
            throw new IllegalStateException("Current OS do not support AsyncProfiler, Only support Linux/Mac.");
        }
    }

    return profiler;
}
 
Example 2
Source Project: codeone2019-java-profiling   Source File: FileConverter3.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    String[] filesToProcess = new File(PATH).list((dir, name) -> name.matches("input.*\\.txt"));
    Objects.requireNonNull(filesToProcess);
    Arrays.sort(filesToProcess);

    FileConverter3 converter = new FileConverter3();
    for (String fileName : filesToProcess) {
        converter.convertFile(PATH + "/" + fileName);
    }

    AsyncProfiler.getInstance().execute("stop,file=profile.svg");
}
 
Example 3
Source Project: arthas   Source File: ProfilerCommand.java    License: Apache License 2.0 5 votes vote down vote up
private static String execute(AsyncProfiler asyncProfiler, String arg)
        throws IllegalArgumentException, IOException {
    String result = asyncProfiler.execute(arg);
    if (!result.endsWith("\n")) {
        result += "\n";
    }
    return result;
}