one.profiler.AsyncProfiler Java Examples

The following examples show how to use one.profiler.AsyncProfiler. 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 File: ProfilerCommand.java    From arthas with 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 File: FileConverter3.java    From codeone2019-java-profiling with 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 File: ProfilerCommand.java    From arthas with 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;
}