I would like to know how much time was spent on the GC and how much memory was collected, but not on the analysis of the GC logs (i.e. the analysis of what I got from -XX: + PrintGCWhatever).
I found that I can use Sun ManagementFactory to get the GarbageCollectorMXBean, which can give me some GCInfo object containing memory information, but I have no guarantee that I can collect all the GC through this value.
Does anyone know a way to do this in code?
java garbage-collection jvm
insitu
source share