Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for multi-event selection if JFR is enabled #88

Conversation

6fears7
Copy link

@6fears7 6fears7 commented Apr 10, 2023

image

Created new builder option: setProfilingEvents

Most notably in Profiler.java, the createJFRCommand ensures that only when the JFR option is enabled will multiple events be used. Otherwise, it'll default to the single Event default set in the Config.

private String createJFRCommand() {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < eventTypes.length; i++) {
            if (i == 0) {
                sb.append("start,event=").append(eventTypes[0].id);
            } else {
                sb.append(",").append(eventTypes[i].id);
            }

        }

Enables end users to utilize the Config Builder to specify multiple event types to mirror the async-profilers command line options

I dig a lot of digging and didn't see any current way in-code for this to work, so if there is and it's simply hidden please let me know.

@korniltsev
Copy link
Collaborator

io.pyroscope.javaagent.config.Config.Builder#setProfilingLock

@6fears7
Copy link
Author

6fears7 commented Apr 11, 2023

Thank you. I was much too focused on getting the method # 1 to work (./profiler.sh -e cpu,alloc,lock -f profile.jfr ...) that I didn't pay any mind to method # 2 (./profiler.sh -e cpu --alloc 2m --lock 10ms -f profile.jfr ...) and how that might've already been used in the Builder

@6fears7 6fears7 closed this Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants