JVM PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime flags

Viewed 5321

I'm running a Java program and I need to get how much time each it spent garbage collecting. I found these 2 JVM flags: -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime

but I'm not being able to find information about it. I suppose that PrintGCApplicationStoppedTime prints for how long the application time was in a STW, however I am not sure about -XX:+PrintGCApplicationConcurrentTime. Does it print for how long the application was executing concurrently with collection threads?

Thanks in advance.

2 Answers

You using those flags to know how long your application runs between garbage collections.

Eventually that can be calculated from the GC logs but a convenient way to see that information is with the command line flags -XX:+PrintGCApplicationStoppedTime and -XX:+PrintGCApplicationConcurrentTime.

Adding these to your command line produces output such as this:

Application time: 0.2863875 seconds
Total time for which application threads were stopped: 0.0225087 seconds
Application time: 0.1476791 seconds
Total time for which application threads were stopped: 0.0255697 seconds

The application ran (reported in the first line) for about 287 milliseconds and then was stopped for about 22 milliseconds (reported in the second line).

The flags can be used separately or together.

Related