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

Add support for profiling Gradle tasks #1639

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ingokegel
Copy link

JProfiler 15 will add VS Code integration and as part of that effort we would like to support profiling Gradle tasks as well. To accomplish that, we need to add an -agentpath VM parameter to a Java invocation that is launcher from the Gradle build.

To allow profilers to add their VM parameters, a registerToolOptionsProvider function was added to the API. When a build is run, the VM parameters are queried from all registered tool option providers, concatenated and sent to the Gradle server where they are added to the JAVA_TOOL_OPTIONS along with the debugger VM parameter.

@ingokegel
Copy link
Author

ingokegel commented Jan 2, 2025 via email

@jdneo
Copy link
Member

jdneo commented Jan 6, 2025

Hi @ingokegel,

Thank you for your contribution.

The PR looks good to me.

May I ask if there is any bit I can use to test the integration?

@ingokegel
Copy link
Author

@jdneo I've added a commit with a test extension that sets a system property via the new mechanism. Is that what you were looking for?

@jdneo
Copy link
Member

jdneo commented Jan 7, 2025

Thank you @ingokegel.

Sorry I did not say it clearly. (It's good to have it for testing though!) I would like to know from customer perspective, how they can use this new feature? Is that a JProfiler vscode extension using this new API? How is the E2E experience looks like?

From our side, these can be some useful materials that we can mention and tell our customers in our feature update blog for VS Code Java.

// fyi @nickzhums

@ingokegel
Copy link
Author

Is that a JProfiler vscode extension using this new API?

Yes, exactly. The JProfiler VS Code extension has a toggle action for profiling. If enabled, launch configurations are profiled and the JProfiler UI is opened when a launch configuration is started. Benefits of such an IDE integration include:

  • You can profile existing launch configurations without any additional setup in JProfiler
  • Source navigation from JProfiler will be performed in the IDE.
  • JProfiler is informed about the packages in the source roots and that information is used to set filters for method call recording

For the VS Code Gradle extension, we need this new functionality so that JProfiler can insert an additional VM parameter that loads the profiling agent when a Gradle task is executed.

How is the E2E experience looks like?

The user will not be dealing with the API, it is just used by the JProfiler VS Code extension. Other profilers can also use this API, there is nothing specific regarding JProfiler about it.

@jdneo
Copy link
Member

jdneo commented Jan 8, 2025

May I ask is the JProfiler VS Code extension available now? I tried to find it in the marketplace but did not find it.

@ingokegel
Copy link
Author

No, it is not published yet because it requires JProfiler 15 which has not yet been released.

@jdneo
Copy link
Member

jdneo commented Jan 8, 2025

I see.

Would you mind me holding this PR until the JProfile extension is about to be released?

If you need a vsix with this change, I can build one for you.

@ingokegel
Copy link
Author

No problem, I will let you know once we have an RC.

If you need a vsix with this change, I can build one for you.

Thanks, but I did manage to build the vsix for testing the JProfiler VS Code extension.

@jdneo
Copy link
Member

jdneo commented Jan 9, 2025

OK, cool!

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.

2 participants