Recently I needed to investigate a CPU overload problem on an embedded system, which ran Oracle EJRE with limited processor power and memory. At the problem time, the Java process took more than 80% of the CPU time. A java profiler, even the shrinked version, such as Jprofiler or YourKit, couldn’t run on this platform.
Luckily, I found a JConsole plugin called TopThreads that came for rescue. After enabling JMX agent on the embeded unit (ip address 10.17.2.3) at port 4567, I ran Jconsole from my PC with the command
jconsole.exe -pluginpath C:\Users\liuzy163\Downloads\topthreads-1.1.jar 10.17.2.3:4567
The sampling frequency may be needed to adjusted as per prompted. But once connected, I was able to see easily tell which Java threads (and their stack trace) were hogging CPU.