Suppose I am testing a Java server application. I know how much time it takes to finish the test. Now I\'d like to know how much was spent on GC during that test. How can I
Another convenient solution is to run jstat -gc (documentation) against your process when your tests are done. That will give you nice aggregated output on exactly how much time has been spent in GC during the lifetime of your JVM.