VisualVM

From Starsector Wiki
Jump to navigation Jump to search

Java VisualVM is a tool that provides a visual interface for viewing detailed information about Java applications, and for troubleshooting and profiling these apps.[1]

In the context of Starsector, it is most useful for finding the cause of the application hanging (softlocks may be harder to track down), and profiling to determine performance bottlenecks.

Using VisualVM to find hangs and profile the game

Starting VisualVM

  • Run jvisualvm.exe (found in the bin directory of a JDK installation, or from VisualVM on GitHub)
    • If you need a JDK, get one here
  • Connect to StarfarerLauncher or the running Starsector game.

Profiling

Note: not compatible with Mikohime Java 23 mod.

Sampler -> CPU; look for the item(s) at the top of the list (taking up the most Self Time).

  • Sometimes this will be a method that's intended to be working hard, but it may also be something that's taking up way more CPU time than it should.

Identifying cause of a hang

With JVisualVM connected, do a thread dump when the game has frozen. This prints some text on the running threads in the application; you can try to find which thread the game is stuck on, or show the output to someone who can.

References