Skip to content

Instantly share code, notes, and snippets.

@Darkere
Last active January 13, 2021 14:21
Show Gist options
  • Save Darkere/3a58d8adfb64738a289c9636544656bc to your computer and use it in GitHub Desktop.
Save Darkere/3a58d8adfb64738a289c9636544656bc to your computer and use it in GitHub Desktop.
Profiling with VisualVm
  1. Download VisualVM https://visualvm.github.io/download.html
  2. Make sure you have a JDK installed. https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot 2.5 When installing make sure to set the JAVA_HOME option to avoid problems. (that is JDK not JRE, if you do not develop java applications you probably don't have it)
  3. Make sure your game is in the state you want to analyze.
  4. Run VisualVM.
  5. Select the process of your game on the left. (for forge this is usually cpw.mods.modlauncher) See image below
  6. Go to the Sampler tab
  7. Wait for the button become valid and click CPU
  8. VisualVM now samples every thread in your game. Pay special attention to:
  • The Server Thread: If the world is laggy or deadlocked this is where to find what it is doing
  • The Render Thread: This is your client (doesn't exist for servers). Here you can see what is tanking your FPS.

Optional 9. You can stop sampling and create a snapshot. This snapshot appears on the left and can be saved and send to people who understand what they may be looking at. image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment