Monitoring CPU, RAM, I/O usage at time of Java Garbage Collection
问题 I am using -Xloggc to output the GC messages to a file. However I am also interested in knowing the system parameters like CPU, Memory, I/O when the GC events happen. I understand that sar linux command is there, but how can I know the metrics at time of GC events instead of manually comparing the results using time stamps. Java 1.7 Oracle enterprise linux 2.6.39 Thanks. 回答1: If you're up to Java 1.7 update 4, you can register a GarbageCollectorMXBean. Here's an example of its setup,