Jstatd on the roboRIO

I am trying to use visualvm / visual gc to look at garbage collection on a java program running on the roboRIO. I can connect visualvm on the DS to the running JVM on the roborio with a JMX connection.

It appars visual gc does not work over JMX, you need to run jstatd on the roboRIO to use visual gc. the JVM installed on the roborio by the wpilib tools does not include jstatd.

is there a full JDK for the roborio somewhere that I can extract jstatd from? What does the JRE that wpilib installs get built from? I can see the .ipk at https://frcmaven.wpi.edu/artifactory/development/edu/wpi/first/jdk/roborio-2020/11.0.4u10-2/, but where does it get built from?)

Looks like it gets built from here: https://github.com/wpilibsuite/frc-openjdk-roborio

ah! I’ll have to take a look…

I ended up avoiding the problem altogether by using another JDK. There isn’t enough space on the file system to install another one, but I brought one over on a thumb drive. RoboRIO is a little short of memory, so it’s a little unstable (the robot code tends to run out of memory…). I’ll retry with a Java 8 JVM for jstatd…

  • fired up my Linux system
  • formatted a crappy thumb drive (need 700Mb) as ext4 and mounted it.
  • downloaded the Zulu JDK for Arm 32 bit soft float (zulu11.37.48-ca-jdk11.0.6-linux_aarch32sf.tar.gz).
  • extracted the Zulu JDK to the root of the thumb drive (it will land in zulu11.37.48-ca-jdk11.0.6-linux_aarch32sf)
  • put jstatd.policy.11 and jstatd.sh onto the root of the flash drive (contents at bottom of this post)
  • chmod a+x jstatd.sh
  • put the thumb drive into the roborio
  • ssh into the roborio.
  • sudo su to admin.
  • the thumb drive should be mounted at /media/sda1, so cd /media/sda1
  • you should be able to ./jstatd.sh
  • now you can go into visualvm and connect to jstatd (at port 12345) from the driver station and use visual gc.

Contents of jstatd.policy.11:

grant codebase "jrt:/jdk.jstatd" {
   permission java.security.AllPermission;

grant codebase "jrt:/jdk.internal.jvmstat" {
   permission java.security.AllPermission;

Contents of jstatd.sh:



export JAVA_HOME=$THUMB/zulu11.37.48-ca-jdk11.0.6-linux_aarch32sf
export PATH=$JAVA_HOME/bin:$PATH

jstatd -J-Djava.rmi.server.hostname= -J-Djava.security.policy=$THUMB/jstatd.policy.11 -p 12345

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.