-
Couldn't load subscription status.
- 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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
|
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 | ||
|
|
||
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.