Measuring time spent on GC in JVM

后端 未结 7 1123
天命终不由人
天命终不由人 2020-12-03 01:47

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

7条回答
  •  长情又很酷
    2020-12-03 02:15

    There are different GC algorithms that behave differently. I recently read a good article on the subject that I can recommend if you'd like to know more.

    You can launch your application with the following command line options -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails and get information about GC.

    Here's an example of the log message:

    2012-12-17T03:02:15.590-0500: [GC [PSYoungGen: 40934K->2670K(29440K)] 48211K->14511K(73152K), 0.5745260 secs] [Times: user=0.08 sys=0.01, real=0.58 secs]

提交回复
热议问题