Is there a way to measure CPU usage of the JVM (once a java application is started) cross platform (windows + unix + mac)? I have used Jconsole but what I need is a java code that does this, and not a tool through which I can monitor CPU utilization. I have tried out
ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage()
using JMX, but it doesn't help since what I need is the specific CPU usage by the JVM (say when I start a server), not the system load average.