-
Notifications
You must be signed in to change notification settings - Fork 285
Add VisualVM simulation profiling instructions #3128
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
Open
jasondaming
wants to merge
1
commit into
wpilibsuite:main
Choose a base branch
from
jasondaming:issue-2861-add-visualvm-simulation-instructions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,9 +6,24 @@ This document is intended to familiarize the reader with the diagnostic tool tha | |
|
|
||
| To begin, [download VisualVM](https://visualvm.github.io/download.html) and unpack it to the WPILib installation folder. The folder is located at ``~/wpilib/`` where ``~`` indicates the users home directory. On Windows, this is ``C:\Users\Public\wpilib``. | ||
|
|
||
| ## Setting up Gradle | ||
| ## Profiling Simulation | ||
|
|
||
| GradleRIO supports passing JVM launch arguments, and this is what is necessary to enable remote debugging. Remote debugging is a feature that allows a local machine (such as the user's desktop) to view important information about a remote target (in our case, a roboRIO). To begin, locate the ``frcJava`` code block located in the projects ``build.gradle``. Below is what is looks like. | ||
| When profiling simulation, no additional Gradle configuration is needed. VisualVM can directly connect to any Java process running on your computer, including robot simulations. | ||
|
|
||
| To profile simulation: | ||
|
|
||
| 1. Launch VisualVM (see :ref:`Running VisualVM <docs/software/advanced-gradlerio/profiling-with-visualvm:Running VisualVM>` below for instructions) | ||
| 2. Start your robot simulation from VS Code | ||
| 3. In VisualVM, the simulation process will automatically appear in the left sidebar under "Local" as a Java process | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having not done this, is it obvious what is the correct process to connect to? I could see it being likely that there's several java processes that show up between VS Code Java stuff, the robot code, gradle daemons, and wpilib tools. |
||
| 4. Double-click the process to begin profiling | ||
|
|
||
| Once connected, you can use all the same features described in this document: CPU sampling, heap dumps, memory monitoring, and more. | ||
|
|
||
| .. tip:: You can also use the [VisualVM VSCode extension](https://marketplace.visualstudio.com/items?itemName=oracle-labs-graalvm.visualvm-vscode) for a more integrated experience. | ||
|
|
||
| ## Setting up Gradle for roboRIO Profiling | ||
|
|
||
| GradleRIO supports passing JVM launch arguments, and this is what is necessary to enable remote debugging of code running on the roboRIO. Remote debugging is a feature that allows a local machine (such as the user's desktop) to view important information about a remote target (in our case, a roboRIO). To begin, locate the ``frcJava`` code block located in the projects ``build.gradle``. Below is what is looks like. | ||
|
|
||
| .. rli:: https://raw.githubusercontent.com/wpilibsuite/vscode-wpilib/v2025.3.1/vscode-wpilib/resources/gradle/java/build.gradle | ||
| :language: groovy | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it flows well to reference things down below that the user hasn't read yet. If simulation is the most common use case then build it into the instructions below, and then add the gradle instructions after that. Or alternately, move this section down below.
I can see arguments for either simulation or robot being the primary use case so I don't really care which one is moved down, but it seems convoluted the way it is now.