perfcounter online tutorial

Check the current JVM Perf Counter information.


$ perfcounter                            2325637411
 java.cls.loadedClasses                       3403
 java.cls.sharedLoadedClasses                 0
 java.cls.sharedUnloadedClasses               0
 java.cls.unloadedClasses                     0                   11.0.4                   mixed mode                   OpenJDK 64-Bit Server VM

Print more information with the -d option:

$ perfcounter -d
 Name                                   Variability   Units        Value
---------------------------------------------------------------------------------                      Monotonic     Ticks        3242526906
 java.cls.loadedClasses                 Monotonic     Events       3404
 java.cls.sharedLoadedClasses           Monotonic     Events       0
 java.cls.sharedUnloadedClasses         Monotonic     Events       0
 java.cls.unloadedClasses               Monotonic     Events       0

JVM above JDK9

If the information is not printed, when the application starts, add the following parameters:

--add-opens java.base/jdk.internal.perf=ALL-UNNAMED --add-exports java.base/jdk.internal.perf=ALL-UNNAMED