See the javadoc.
Example usage:
import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; public class LoadAverage { public static void main(String[] args) { final OperatingSystemMXBean osStats = ManagementFactory.getOperatingSystemMXBean(); final double loadAverage = osStats.getSystemLoadAverage(); System.out.println(String.format("load average: %f", loadAverage)); } }
This is a rather useful feature if you are writing software that should do less when the overall system load is high.
For example, if you’re me, you might be working on a java daemon that is instructing some CouchDB instances on the same box to do database compactions and/or replications, and you could use this to tune down the concurrency or the frequency if the load average is above a threshold.